Skip to content

Instantly share code, notes, and snippets.

@WillSquire
Last active December 18, 2015 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillSquire/45f59877478e5241c24c to your computer and use it in GitHub Desktop.
Save WillSquire/45f59877478e5241c24c to your computer and use it in GitHub Desktop.
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment