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 HostName 18.104.22.168 User YourUserName Port YourSSHPort
- 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