DEV Community

Aaron Dunphy
Aaron Dunphy

Posted on • Edited on • Originally published at aarondunphy.com

3 1

How to Setup Quick SSH Access

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
Enter fullscreen mode Exit fullscreen mode

Machine Setup

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

cat ~/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode

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

ssh-keygen
Enter fullscreen mode Exit fullscreen mode

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

sudo nano ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode

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

Host *
     UseKeyChain yes
Enter fullscreen mode Exit fullscreen mode

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

Host server_name
     HostName ip_address
     User server_user
     IdentityFile ~/.ssh/id_rsa
     IdentitiesOnly yes
Enter fullscreen mode Exit fullscreen mode

Copy your machine's ssh public key:

cat ~/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

You can then ssh on via

ssh server_name
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay