“Silky Smooth Hopping” is a term coined by Paul Irish at the HTML5DevConf held by marakana on November 5th, 2012. It’s a way to login via SSH painlessly and with ease. You’ll need to know what the Terminal is before you begin, and have some knowledge of basic commands (e.g. listing directories, viewing file contents, etcetera). You’ll also need to know how to create a public SSH key with a service such as Github. What we’re gonna do is really not that difficult –and honestly, I’m no Terminal whiz either so I’ll make sure to hold your hand every step of the way.
Workflow and workspace setup can be one of those things easily forgotten and often under–estimated in its value. I’ve never been too crazy when it comes to my workflow, but over time I’ve grown to appreciate its effectiveness.
What is SSH and what does it do?
Secure Shell (a.k.a SSH is a cryptographic network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that connects, via a secure channel over an insecure network, a server and a client (running SSH server and SSH client programs, respectively). The protocol specification distinguishes two major versions that are referred to as SSH–1 and SSH–2.
SSH also lets you run terminal commands on another computer out on the internet, like your personal server. That means you could set up version control on your remote server and pull in your changes from the working repo and correlating branch with a service like Github.
The Silky Smooth Setup
Usually when we SSH into a remote server we’ll start by typing out
ssh followed by a unique username which will be something like “
firstname.lastname@example.org.” It will look like this in the Terminal:
$ ssh email@example.com Password:
Notice that it’s requesting a password. Ugh! That’s really annoying, but we can clean this step up and create a silky experience for ourselves. First order of business is to set up a
config file in the
~/.ssh directory of your local machine, that contains these lines from the example below:
Host $custom_name HostName $custom_host_name Port $custom_port_number User $custom_username
You should replace the variables prefixed with a dollar sign with your own values particular to your project. In my case
$custom_name is ‘mt’ so my
config contents looks like this…
Host mt HostName myhost.com Port 22 User myhost.com
This configuration will let me do the following from my shell…
$ ssh mt
This is cool, but we’re still asked for a password once that command is executed. Let’s go ahead and get rid of that annoying password request by copying the contents of
id_rsa.pub from your local machine’s
.ssh directory using the following command (I should also note that
pb commands are Mac OS X specific).
cat ~/.ssh/id_rsa.pub | pbcopy
This will copy the contents of the public ssh key you’ve created with github / repo service to your local machine’s clipboard. Now all you need to do is create a file called
authorized_keys and paste the contents into your
authorized_keys file on your remote server. If you’re using MediaTemple then you can’t use
pb commands like
pbpaste as they are OS X specific as previously mentioned, so I suggest using FTP and gaining access that way –unless you’re good with Vim. For me FTP was quick and painless –did I mention extremely quick?
So now you’ll have a file called
authorized_keys in the
.ssh directory of your remote server. This will remove that annoying password request each time you SSH into your remote server. So in my case, I can execute
ssh mt and gain immediate access. No password, no entering annoying email usernames, just quick and painless SSH hopping. It’s a small adjustment, but an adjustment that will make you smile from ear to ear and wonder why you lived without it for so long.