Creating SSH Aliases / Shortcuts

Suhas Somnath
Advanced Data and Workflows Group
National Center for Computational Sciences
Oak Ridge National Laboratory

10/9/2017 Updated 9/16/2020

This is applicable to Mac OS and Linux ONLY

Often you may need to connect to multiple remote machines each with its own public, private keys, usernames etc. Accessing remote machines can be simplified substantially using aliases.

  1. Create (if it doesn't already exist) / edit the configuration file:
vim ~/.ssh/config
  1. Add details regarding your machines. Here is how I have set up my Jupyter / Python VM:
Host jupyterVM
  HostName 172.22.3.50
  User cades
  1. Access the remote machine:

ssh jupyterVM instead of ssh cades@172.22.3.50

Other communication protocols including sftp are also simplified in the same way.

I do not have an answer yet on how to set up an alias for port forwarding. If you do, please feel free to share!