It is very easy to use SSH to log on to a remote host under Linux, but for lazy people, it is a very painful thing to enter the password frequently, and then you can login to the server without entering the remote host password.
The following operations are done on the local host, not the root user, and the system is a Debian wheezy.
Local Host:
Ssh-keygen-b 1024-t RSA
Pressing ENTER ENTER key continuously will generate two files under ~/.ssh/:
Id_rsa id_rsa.pub
All we need to do is upload id_rsa.pub to the remote host.
#远程主机添加. SSH Directory
SSH leung@192.168.1.10 ' mkdir ~/.ssh '
Append the local host's id_rsa.pub to the remote host's ~/.ssh/authorized_keys and specify the port if the remote host SSH port is not 22:
Cat ~/.ssh/id_rsa.pub | SSH leung@192.168.1.10 ' cat->> ~/.ssh/authorized_keys '
Test:
SSH leung@192.168.1.10
Successfully logged on to the remote host and the setup succeeded.
The above is a simplified version of the operation, if you want to split operation, you can id_rsa.pub the local host SCP to the remote host, and then log on to the remote host, manually append id_rsa.pub content to Authorized_keys.