Tuesday, July 15th, 2008...8:41 pm
SSH Config Aliases
If you are like me, you do quite a bit of connecting to remote servers via SSH. Well, here is a quick timesaving hint to save you a few keystrokes.
Instead of having to type
ssh username@hostname.com
from the command line to connect to your server each time, wouldn’t it be nicer to just type something like this
ssh foo
Well, if you edit your ssh config file you can add these aliases. You should most likely find your ssh config located in your user directory at ~/.ssh/config . If the file doesn’t already exist, go ahead and create it.
To add aliases you simply add new Host entries in the following format
Host aliasname HostName your.domain.name User your_ssh_username Port 1234
Just give the alias you want to use and supply your server and username credentials. The Port line is optional if you are using the default SSH port (which you shouldn’t be for security reasons, but that’s beyond the scope of this post). Once you add those entries to your config file you can simply do the following and save yourself some typing:
ssh aliasname

Leave a Reply