Once a geek, forever a geek…

Setting up SSH host shortnames

| 3 Comments

Here’s an example setup to create SSH host shortnames. On your local computer, add the following to ~/.ssh/config :

Host server1
HostName server1.internet.com
User marius
 
Host server2
HostName server2.internet.com
User marius
 
Host *
User marius

Now with this file saved, you can ssh into server2.hostname.tld with just the following command:

ssh server2

This will save you having to type out:

ssh marius@server2.hostname.tld

And if you have public key authentication setup, it makes the process even smoother. Adding the wildcard host record at the bottom allows you to specify a default username to use for other servers to the ones you’ve not specified above.

Related Posts

Author: Marius Voila

Hi! My name is Marius Voila, and I am a professional system administrator, system architect, and designer.

3 Comments

  1. Great post, just tried it on my Debian ;)

  2. Yep…one of my favorites :P

  3. Pingback: Connecting to Amazon EC2 server using ssh config file | Once a geek, forever a geek...

Leave a Reply

Required fields are marked *.

*