In fact, this problem online, the garden has a lot of blog introduction, but most of them ignore a problem, is to generate the public key is not to enter the password, tidy up:
1. There is a B two machine (Linux/unix), you want to telnet to B from A with SSH (assuming the respective ip,a:192.168.100;b:192.168.1.104).
2. On the A machine, use the "ssh-keygen-t RSA" command to generate the public key, note that this is always the return. Well, at this time under the "~/.ssh/" has been generated "Id_rsa, id_rsa.pub" two files.
3. Also on the A machine, the id_rsa.pub file just generated to copy to the B machine, you can use the command "SCP ~/.ssh/id_rsa.pub [email protected]:/home/root/", then the Id_ The Rsa.pub file was copied to the/home/root of Machine B.
4. Log on to the B machine with the root user and you will see the id_rsa.pub file that you just copied, using the command "cat id_rsa.pub >> ~/.ssh/authorized_keys" Add the public key of the A machine to the Authorized_keys file, (sometimes ~/does not have an. ssh folder or no Authorized_keys file, if so, create it yourself manually).
5. Also on the B machine, restart the sshd service, command "service ssh restart".
6. Back to the a machine, try, command "ssh [email protected]", no need to log in unexpectedly without a password!
Things to keep in mind:
1. ssh-keygen-t RSA to generate the public key, always enter the password is not entered, is the empty password.
2. To use which user remote login to copy the id_rsa.pub to the user corresponding path, such as: root user copied to/root/under; Andychen the user is copied to/home/andychen/, do not mix.
3. File permissions on machine B:. SSH folder (*); Authorized_keys (600).
SSH password-free telnet to Linux