ssh -p 2222 email@example.com
into an easily customizable shortcut:
This is accomplished by creating a text file located at
~/.ssh/config on your local machine with a few pieces of information and ensuring a specific set of permissions are applied to that file.
- Make the
~/.ssh/directory if it does not already exist:
- Set the permissions for the
~/.ssh/directory such that it is readable, writeable, and executable for only the current user (i.e.
chmod 700 ~/.ssh/
- Create a text file at
~/.ssh/configfollowing this example format:
Host cs HostName student.cs.uwaterloo.ca User alykhan Port 2222
Note that this file must also meet specific permissions requirements as specified by the
ssh_config man page (i.e.
~/.ssh/config— Because of the potential for abuse, this file must have strict permissions: read/write for the user, and not accessible by others.
chmod 600 ~/.ssh/config
Congratulations! You may now connect to the SSH host via:
Feel free to add multiple
Host entries to the
config file, to have quick access to different
HostNames via shortcuts like
ssh work, etc. Each of these entries may also have different
Port, and other configuration values.