From 4332e33a74a927e3f19c114f586888fb6dbd9454 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sun, 30 Jul 2017 12:13:42 -0400 Subject: [PATCH] Documents SSH tooling --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/README.md b/README.md index 4ce60a142..71575409c 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,63 @@ scripting. That is too severe. Instead, I see this as a necessary upgrade for my foray into writing more sophisticated tools for myself and others. +# SSH + +Here are a few useful tips for working with SSH. + +## ssh_config + +Instead of creating shell aliases and functions for conveniently accessing remote nodes over SSH, +edit your `~/.ssh/config` file. + +Instead of doing this... + +```bash +$ alias ec2='ssh -i /path/to/identity_file.pem ubuntu@' +``` + +...edit your `~/.ssh/config`: + +``` +Host ec2 + User ubuntu + HostName + IdentityFile /path/to/identity_file.pem + +# Host * configuration below... +``` + +## sshfs + +SSHFS enables seamless file transfers from your local machine to a remote machine. + +To install, run: + +```bash +$ brew cask install osxfuse +$ brew install sshfs +``` + +Assuming your remote machine is configured in your `~/.ssh/config` (see above), you can mount your +remote machine's home directory on your local machine like so: + +```bash +$ mkdir ~/ec2 +$ sshfs ec2:/home/ubuntu ~/ec2 -o reconnect,follow_symlinks +``` + +Now your remote machine's home directory can be accessed using the `~/ec2` directory. This directory +can be transparently treated as if it were an ordinary local directory. To illustrate how easy it is +to use, let's install `Vundle`, a Vim package manager, on our remote machine. + +```bash +$ git clone https://github.com/VundleVim/Vundle.vim.git ~/ec2/.vim/bundle/Vundle.vim +``` + +Voila! We now have `Vundle` installed on our ec2 instance without needing to SSH into that machine +ourselves. That's all there is to it. + + # GnuPG 1. Download public key from keyserver