How to give aliases to SSH user and IP addresses

Siva
1 min readMar 26, 2022

As you ssh into multiple machines or servers, it can get hard to remember the IP address of each of the server you have.

For example, if your application has different servers for app-server, cache, database, etc… there could be a different IP for each one of them.

> ssh user@10.45.32.42> ssh user@10.235.23.46

To reduce this cognitive overload, you can create a ssh config that removes the need to remember the usernames and IP addresses of the servers.

To get started, create a ~/.ssh/config file if it doesn’t exist.

touch ~/.ssh/config

Now, open the config file and add the following configuration

Host app-server    HostName <IP_address_of_app_server>    User <user_to_login>Host database    HostName <IP_address_of_database>    User <user_to_login>

Once you add the above config, you can ssh into the servers with this command

$ ssh app-server

Hope this reduces some cognitive load for you.

--

--