Operating Environment: CentOS 6.5
Action object: User A host and remote Host B
Body part: Italic bold represents Linux instructions.
Linux non-root user password-free login remote host SSH Please go to this link: xxxxxxxxxxxxxxxx (not yet written)
One, remote Host B and user A are installed OpenSSH
First we check whether the remote host installs OPENSHH and rsync
Rpm-qa|grep OpenSSH
Rpm-qa|grep rsync
If no information is returned and the representative is not installed, we install it with the Yum command.
Yum Install Openssh-y
Yum Install Openssh-server-y
Yum Install Openssh-clients-y
Yum Install Rsync-y
(Delete openshh and rsync
Yum Remove openssh-y
Yum Remove rsync-y)
second, the user a host generates the public and private keys.
ssh-keygen-t rsa-p ' (' Default path ')
When prompted, enter to install the public and private keys in the default path. /root/.ssh/id_rsa and/root/.ssh/id_rsa.pub
third, remote Host B creates the/root/.ssh folder.
The remote host holds the path to the public and private keys in the/root/.ssh/authorized_keys file.
Because the remote host did not pass the second step, there is no/root/.ssh this folder.
The/root/.ssh folder can be obtained from the two different methods of creating a file with Linux instructions or generating a public and private key on a remote host .
⑴ through the Linux directive (this needs to consider the permissions of the folder, otherwise the user a host cannot log on to remote Host B without a password),
Here's how:
On remote Host B
⑵ performs the second step to obtain the public and private keys while obtaining the/root/.ssh folder (the benefit of doing so without considering the permissions of the folder),
Here's how:
ssh-keygen-t rsa-p ' (' Default path ')
When prompted, enter to install the public and private keys in the default path. /root/.ssh/id_rsa and/root/.ssh/id_rsa.pub
Four, the user a host's public key is still on the remote Host B.
In the third step, we obtained the/ROOT/.SSH folder on the remote Host B, and now we place the public key of the user a host under the folder, and then append it to the/root/.ssh/authorized_keys file.
/root/.ssh/authorized_keys files may not be available beforehand.
Here's how:
⑴ still public key:SCP ~/.ssh/id_rsa.pub [email protected]:~/.ssh(User a host operation)
⑵ Append to File: Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys (remote Server B host operation)
⑶ Modify the contents of the/etc/ssh/sshd_config:
Vi/etc/ssh/sshd_config
(#RSAAuthentication Yes
#PubkeyAuthentication Yes
#AuthorizedKeysFile. Ssh/authorized_keys
Find the above 3 statements and take the previous # number off)
Note: Some articles say to/root/.ssh this folder and/root/.ssh/authorized_keys this file, you have to modify the permissions.
However, in my operation under root, if you change the/root/.ssh/authorized_keys file permissions to 600 will not be able to use password-free login, it is best to not change permissions under root.
Five, User a host password-free logon remote server B.
SSH 192.168.31.230
You can login without a password. (Exit exit)
At this point we also completed the Linux root user password-free login to the remote server.
"Hadoop series" Linux root user password-free login to remote host SSH