Usually in the use of SSH under Linux, we need the target machine to open the SSHD service and then connect with the SSH client in the past to the designated user to log on, under normal circumstances we need to enter the login password to successfully login, But in a cluster or similar scenario we have a lot of machines that need to be randomly accessed through SSH, if one of the input passwords is too cumbersome. Therefore, we need to establish a key-free login mode.
One-way trust configuration
A server: 192.168.0.101
B Server: 192.168.0.102
Requires B server to be able to password-free access to a server
Actions on Server B:
[email protected]. ssh]# ssh-keygen-t RSA #rsa算法的证书
Generating public/private RSA key pair. (The following carriage return)
Enter file in which to save the key (/ROOT/.SSH/ID_RSA):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? Y (because my certificate already exists, overwrite can be)
Enter passphrase (empty for no passphrase):
Enter same Passphrase again:
Your identification has been saved In/root/.ssh/id_rsa. Private key
Your public key has been saved in/root/.ssh/id_rsa.pub. Public key
The key fingerprint is:
c1:26:cc:88:2b:05:dd:c3:6b:1e:78:5d:da:9c:da:8a
The certificate generates a ID_RSA (private key) |& id_rsa.pub (public key)
SCP id_rsa.pub 192.168.0.101:/root/.ssh/#把公钥拷贝到A服务器
operation on Server A
CD ~/.ssh/
MV Id_rsa.pub Authorized_keys
chmod Authorized_keys
Test
On the B server 192.168.0.102
SSH 192.168.0.101 Date
Multi-node Trust configuration
Each node server runs ssh-keygen-t RSA under the. SSH directory, and then copies a copy of the public key in the id_rsa.pub of all nodes into the Authorized_keys file.
Finally, put a copy of the. SSH directory for each node of the Authorized_keys file, and change the permissions to 600.
This multiple nodes can be password-free access to each other!
This article is from the "Tranquility Zhiyuan" blog, please be sure to keep this source http://irow10.blog.51cto.com/2425361/1841415
Linux SSH one-way trust and multi-node mutual trust