Recently in the study of a file system, you need to remotely install software to the client, and need no SSH password access, in addition to remote to the client to pass files, each time the root password is inconvenient, it is thought to use SSH key to generate a public key, private key to verify, and avoid having to enter the root password each time.
Server Architecture:
System: CentOS 6.5 x64
Main control Terminal a:192.168.0.150
Remote host b:192.168.0.151
principle:
Using SSH key to generate the public key, the private key, the key is equivalent to a key, and the public key is equivalent to aDoor lock, of course, we are holding the key to unlock, the same reason, we put the key on the local server, that is, Server A, the public key on the remote server, that is, the far end of Host B, then we can from the main terminal a ssh password login to the remote Host B.
Steps:
1 . Generate a public and private key file without SSH password access on the host console a
[[email protected] ~]# ssh-keygen -t rsa
Note: The execution of the command, press three consecutive carriage return can be generated.
2 . Upload the public key from the main terminal to the remote Host B
[[email protected] ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub [email protected]
You need to enter the root password of the remote Host B
3, in the main control side test password-free SSH remote Host B
[[email protected] ~]# ssh [email protected]
You can see that you have not lost the root password of Host B, you can remote from a SSH to B.
CentOS configuration ssh One-way no password access