As I've spent more and more time using SSH with different machines, it has quickly become something of a bother looking up the IP address of each machine every time I needed to make a connection.
As ever with these things, if you're willing to do a little digging, there's usually a solution (or two). If you're on MacOS (or any *NIX system) then the following is probably the simplest way to handle SSH aliases.
Start by moving into the hidden ssh folder in your user directory:
Create a file called
config (if it doesn't already exist) and edit it using a text editor of your liking (I chose nano):
You then want to set the file up as per the following example:
Host mycoolalias HostName 220.127.116.11 User myuser Host myotheralias HostName 18.104.22.168 User myotheruser
Of course, you're going to want to replace
mycoolalias with something memorable, e.g. for the server running this site I use the alias
blog. Your user is going to be the username you login with (hopefully not root).
Save the file and exit (Ctrl+X if you used nano) then your alias should be available by running:
You can set up as many of these as you want as per the example above. There are a tonne more options that you can set for each host and if you're so inclined you can go ahead and check out the OpenSSH manual pages.
Thanks for reading!
Photo by Daria Tumanova