Friday, April 5, 2013

SSH Host Aliases


November 18th, 2008 By: Wes

If you use SSH from the command line you can save yourself some typing by aliasing the servers hostname to something shorter. There’s a bunch of different ways to get similar results, but I prefer to use the built in SSH functionality for this. Create a ~/.ssh/config file. The syntax is:
Host server
HostName server.example.com
User username
 
Host another
HostName another.example.com
User username
Now you can just ssh server instead of ssh username@example.server.com. SCP also works great with these aliases, just scp file.txt server:/path
You can leave the User part out of the config file if your local and remote usernames are the same.

No comments:

Post a Comment