How to Setup Quick SSH Access

19 March 2020

In this article you will learn how you can set up a quick and easy way to SSH onto any server without needing to remember the user or IP address. This will work by running a command similar to:

ssh server_name

Machine Setup

Check if your machine already has a public SSH key generated:

cat ~/.ssh/

If you see “No such file or directory” then generate a SSH key otherwise skip this step (click enter at all prompts):


Edit the SSH config file to setup quick SSH access to a server from your local machine:

sudo nano ~/.ssh/config

Ensure all hosts use key chain is at the top of the file:

Host *
     UseKeyChain yes

Then you can insert as many host references as you would like. Insert the following (changing the servername, ipaddress and server_user):

Host server_name
     HostName ip_address
     User server_user
     IdentityFile ~/.ssh/id_rsa
     IdentitiesOnly yes

Copy your machine's ssh public key:

cat ~/.ssh/

Server Setup

Add your machine's SSH public key to the server's authorized_keys file (you will need to SSH onto the server with ssh user@ip first):

sudo nano ~/.ssh/authorized_keys

You can then ssh on via

ssh server_name

© Aaron Dunphy 2021

Built with Gatsby & ☕️