Blog

Learning by doing.


How to SSH without Password?

Aug 16, 2014 • Linux • Tags: Linux SSH

Do you use ssh to login a server remotely? Have you been tired of typing in your password again and again? Let’s see how to ssh without password!

Step 1. Generate a pair of authentication keys locally.

ssh-keygen -t rsa

Type in Enter till it’s done. Then you will get two files in your ~/.ssh directory: one is id_rsa, which is your private key; another is id_rsa.pub, which is your public key.

Step 2. Upload your public key to the remote server.

cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'

Type in your password, then your loacal id_rsa.pub will be uploaded to the remote server.

Step 3. Deal with the authority stuff if necessary.

On the remote server:

chmod 640 .ssh/authorized_keys
chmod 700 .ssh

Now you will be capable of loging into your remote server withou typing in your password. Yey~

Reference

SSH login without password

Lnux/UNIX下使用ssh-keygen设置SSH无密码登录

Tags: Linux SSH