Objective
I'm going to write another article on my father's tutorial.
What you need to figure out is that
1, to understand which Linux host login which Linux host does not require a password?
2, the two host user name password consistent (recommended to do so, although there is root).
About it
If a host login B does not require a password, then you need to generate a public key on Host B, then import the public key to a host, and B host to the public key of B host.
Id_rsa: Private key
Id_rsa.pub: Public Key
Assume that the B host login A host does not require A password , as opposed to the above
Both a host and B host. Requires 700, and 600 permissions.
chmod ~/.ssh chmod ~/.ssh/authorized_keys
Practice is the truth
Here I configured is a host password-free login B Host
1. Generate the public key on the B Host and import the public key
[Email protected]:~/.ssh$ ssh-keygen-t rsagenerating public/private RSA key pair. Enter file in which to save the key (/HOME/SHAOYANG/.SSH/ID_RSA):/home/shaoyang/.ssh/id_rsa already exists. Overwrite (y/n)? [Email protected]:~/.ssh$ [email protected]:~/.ssh$ lsauthorized_keys id_rsa id_rsa.pub[email protected]:~/.ssh$ cat ~/ . ssh/id_rsa.pub >> ~/.ssh/authorized_keys[email protected]:~/.ssh$
2. Copy the public key to host a and import the public key
[email protected]:~$ hmod 600 ~/.ssh/authorized_keys no command ' Hmod ' found, did you mean: Command ' qmod ' from package ' Gridengine-client ' (Universe) Command ' chmod ' from package ' coreutils ' ( Main) Command ' mod ' from package ' monodoc-base ' (main) hmod: command Not found[email protected]:~$ chmod 600 ~/.ssh/authorized_keys [email protected]:~$ ssh 192.168.200.5The authenticity of host ' 192.168.200.5 (192.168.200.5) ' can ' t be established. ecdsa key fingerprint is 9b:0f:81:3e:75:fd:64:2a:ab:34:df:1d:ba:7f:a5:9f. are you sure you want to continue connecting (yes/no)? yesWarning : permanently added ' 192.168.200.5 ' (ECDSA) to the list of kNown hosts. welcome to ubuntu 12.04.4 lts (gnu/linux 3.11.0-15-generic x86_64)/******** Here is my manual add, the actual login has been successful ********************************/ * documentation: https:// help.ubuntu.com/326 packages can be updated.216 updates are security Updates. new release ' 14.04.3 lts ' available. run ' Do-release-upgrade ' to upgrade to it. last login: wed aug 19 18:36:39 2015 from 192.168.200.4[email protected]:~
Note Be sure to change the. SSH directory permissions and Authorized_keys file permissions, as well as the A and B hosts to import the public key. That is, the following code
chmod ~/.ssh chmod ~/.ssh/authorized_keys cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
Linux Configuration password-free remote login