How to give aliases to SSH user and IP addresses

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@> ssh user@

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.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store