Auto-Authenticating in SSH

Apr 10, 2021

Here's the recipe for auto-authenticating in SSH with a public-private key pair. I'm recording this here because I can never remember exactly how to do this (I do it so infrequently).

Assumption: You have already created a public/private key pair to use. In Windows, this is typically done with puttygen or kittygen (or something similar).

# On the server
cd ~
mkdir .ssh
chmod 700 .ssh

# Here's the magic
ssh-keygen -i -f mykey.pub >> ~/.ssh/authorized_keys
chmod 600 authorized_keys

Once the server-side stuff is done, add the private key to the connection setup in the Kitty/Putty session configuration.

No comments (yet!)

Leave a Comment

Ignore this field:
Never displayed
Leave this blank:
Optional; will not be indexed
Ignore this field:
Both Markdown and a limited set of HTML tags are supported
Leave this empty: