Fast Connection with SSH Aliases

If you need to regularly connect to a lot of different servers over SSH, this trick is for you.

Editing SSH configuration file and adding SSH aliases will make the process of the remote connection much more convenient.

Edit SSH configuration file for current user :
$ vi ~/.ssh/config
or edit the main configuration file, if you want to make this alias available for all users :
$ vi /etc/ssh/ssh_config
Add the next lines :

###   Fast connection aliases   ###
Host AliasName
User YourUserName
Port YourSSHPort

Where :

  • Host - an alias for the target host;
  • HostName - a domain name or an IP address of the target host;
  • User - a user name for the ssh connection;
  • Port - an ssh port on the target host.

Now you can connect to the target host using simple alias :
$ ssh AliasName