Telling SSH your account name
Here’s a handy SSH hint for when your remote account name is different to the local one. It isn’t an earth-shattering discovery: it’s something that I had done before, forgotten, and was just reminded of.
My account on my work computer is paulbattley
. (I
don’t think I’m giving away anything secret there!) My account on
RubyForge, however, is
pbattley
. In order to use source control or to upload
web files, I need to tell SSH to use the latter account name. You
can do this as simply as accountname@…
. The RubyForge
documentation itself suggests:
svn checkout svn+ssh://[email protected]/…
And that works very well in the case of Subversion, where the path is stored in the local copy of the code. However, it’s inconvenient for some other situations: if I write a Rake task to generate and upload documentation to the project web space, I have to store my account name somewhere—and that’s made more complicated if there is more than one person on the project.
As one might reasonably expect, SSH can handle this common
scenario. The solution requires only two lines in
~/.ssh/config</ssh>:
Host rubyforge.org
User pbattley
Incidentally, if you are still typing your SSH password,
you might want to read up on shared
keys. If you’re using Mac OS X, have a look at SSHKeychain for securely managing
shared keys.