WillSquire
9/3/2015 - 11:10 AM

SSH - Config connection aliases.

SSH - Config connection aliases.

Config connection aliases

Open up the SSH config for the current user profile with:

~/.ssh/config

OR

If SSH config does not exist, create the directory and file with:

sudo nano ~/.ssh/config

Next enter in the server connection information in the following format:

Host <host_config_name>    
  HostName <host_address> #ip or url     
  User <ssh_username>
  Port <number>
  PreferredAuthentications publickey #Lets it know we want to use RSA authetication
  # Custom RSA file path only
  IdentityFile ~/.ssh/<rsa_key_to_use> #If not default RSA file
  IdentitiesOnly yes #Stops SSH from trying default RSA if custom is set

The Host name is what will be written to used these SSH setting when calling the SSH command.

To connect to the server via SSH the <host_config_name> can now be used by shorthand. Connection can be established like so:

ssh <host_config_name>