SSH login without password

1. generate local key

ssh-keygen

This will generate id_rsa.pub and id_rsa in ~/.ssh/

2. Copy public key to target machine

ssh-copy-id user@target

then it will login without passwd.

3. Sometimes you will need to login with root permission

vim /etc/ssh/sshd_config

Change "PermitRootLogin yes" 

4. Restart ssh service

/etc/init.d/ssh restart

 

 

Keep SSH Alive

Add the following line to the /etc/ssh/ssh_config file:

ServerAliveInterval 60