SSH login without password

This is one of the things every command line geek needs every once in a while. Note that you should never do this on a public computer. If you have not generated an RSA key yet, do it with this command:

ssh-keygen -t rsa

You can decide whether to use a password or not. Then, display the key with

cat ~/.ssh/

Copy the key to clipboard and log in with ssh to your server you want to have passwordless. On the remote server, run

nano ~/.ssh/authorized_keys

Paste the key to that file and save it (in nano it’s CTRL+O and to quit use CTRL+X). If you prefer vim, use it instead of nano. If .ssh directory cannot be found, create it with mkdir ~/.ssh and edit the authorized_keys as above.

After this, you can ssh into the machine without having to type a password.

Thanks for reading! I need your attention for a moment.

Did your problem got solved? Did you enjoy this post? If so, consider thanking me on Patreon. Doing this is not free and I'd love you buy me a beer or coffee. If you do that, I might be able to help you if you didn't get your problem solved with this blog post. I know my shit around areas like website design, coding, blogging, digital marketing and SEO so if you want to do business with me in other ways let me know.

Roni Laukkarinen

Editor-in-chief and owner of Geeky Lifestyle blog. Truly a jack of all trades, a Swiss knife; an avid tech and multimedia geek, coder, owner of a digital agency company, sysadmin, music enthusiast, artist and film critic.

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow The Geek

Geeky Lifestyle is a huge tweeter! Follow @thatgeekyblog to get real-time updates about what's happening in the scene.