Password-less SSH
Needs / Issues
- Frequently connect to remote computer, need to input password several times (Annoying!);
- Connect to multiple computers, get mixed up with credentials (Expected);
- Reverting to insecure protocols (FTP, ...) to do recurrent tasks (Very bad!).
Audience
- Administrator / Power user;
- Adventurous end user.
Initial Setting
- Local computer: LOCALHOST
- Remote computer: REMOTEHOST
- OpenSSH installed on both;
- DNS configuration so that LOCALHOST and REMOTEHOST resolve properly.
Can always use IP address instead.
Steps
-
On remote computer:

- Open the SSH server configuration file:
vi /etc/ssh/sshd_config
- Make sure the following lines are uncommented:
RSAAuthentication yes
PubkeyAuthentication yes - Restart the SSH server:
service sshd restart
- Open the SSH server configuration file:
-
On local computer:

- Go to your SSH local directory:
cd ~/.ssh
- Create Key pair:
ssh-keygen -t rsa -f KEY_NAME
Press 'Enter' twice (to create it without passphrase).
- Add your private key to your local SSH agent:
ssh-add KEY_NAME
- Add your public key to the remote SSH agent:
ssh-copy-id -i KEY_NAME.pub REMOTE_USER@REMOTEHOST
Input the password of the remote user.
- Go to your SSH local directory:
After doing those steps, you should be able to execute SSH-based commands (ssh, scp, ...) without inputting a password.
If not, let me know what went wrong.