Ssh shorthand name for hostnames

Photo of author
Written By Jan Reilink

Windows Server system administrator & enthusiast.

How to use shorthand names for hostnames with ssh? You don’t always want to type in a complete host name when using ssh to remote hosts. Here is how to configure and use shorthand hostnames with ssh.

Configure shortened names for hosts for use with ssh

If you want to configure shortened names for your servers & hosts for use with SSH, follow the next steps:

Open up your .ssh/config file:

vi ~/.ssh/config
Code language: Bash (bash)

and add the following:

Host your_short_name HostName server.on.the.web User user_to_user
Code language: Bash (bash)

Save the file and exit (:wq).

Now you can use β€˜ssh your_short_nameβ€˜ instead of: ssh -l username

Pretty neat, right?! :-)

want to manually install OpenSSH in Windows Server? Or Tunnel RDP through ssh?

Did you like: Ssh shorthand name for hostnames

Then please, take a second to support Sysadmins of the North and donate!

Your generosity helps pay for the ongoing costs associated with running this website like coffee, hosting services, library mirrors, domain renewals, time for article research, and coffee, just to name a few.

4 thoughts on “Ssh shorthand name for hostnames”

  1. This does not seem to work if the long form hostname relies of further configuration entries (with wildcards). e.g.:

    Host short

    Host *.name
    User myspecialusername

    • Thank you for your comment Daniel. One entry can overrule another, yes. You can try to fiddle with CanonicalizeHostName and similar settings, see I sometimes use Hostname in a Host section and doing so allows me to ssh to server1 instead of


Hi! Join the discussion, leave a reply!

%d bloggers like this: