Note: SSH password-free interoperability, should be for more than one server communication, I only use a server to do processing. 1, modify the host name.
Vi/etc/sysconfig/network
Networking=yes
hostname=centos1
vi/etc/hosts
#末尾添加 IP host name
192.168.9.129 CENTOS1
Hostname centos1
#修改主机名临时生效
2, no password login implementation
2.1. Create Public key with Ssh-keygen (each server needs to be executed)
[Root@centos1 ~]# ssh-keygen-t RSA
generating public/private RSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_RSA):
Enter passphrase (empty for no passphrase):
enter same PA Ssphrase again:
Your identification has been saved.
Your public key has been saved in/root/.ssh/id_rsa.pub.
The key fingerprint is:
a0:85:f4:58:d4:c7:2f:d9:ae:b1:04:91:b1:a0:9e:93 root@centos1 the
key ' s Randomart Image is:
+--[RSA 2048]----+
| . +.. + |
| . *. +.O |
| + +. O + |
| . =. o O | | E S. o |
| . O. |
| . + |
| o |
| | +-----------------+
Password-free interoperability, direct return to complete.
Ssh-keygen: Generate secret key
which
-t specifies an algorithm
-f Specifies the build secret key path
-N Specify password 2.2, view the generated key
[Root@centos1 ~]# CD. ssh/
[root@centos1. ssh]# ls
id_rsa id_rsa.pub known_hosts
2.3 Copy the public key to the. SSH directory under the managed machine (make sure this directory exists first)
I am a stand-alone machine here, so I do not need to do this procedure.
Then execute
[ROOT@CENTOS1. ssh]# cat id_rsa.pub >> ~/.ssh/authorized_keys
[root@centos1. ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
4. Set file and directory permissions:
Set Authorized_keys Permissions
chmod Authorized_keys
setting. SSH Directory Permissions
chmod 700-r. SSH
Verify success
[ROOT@CENTOS1. ssh]# ssh centos1 last
login:thu Dec 10:15:52 2015 from 192.168.9.1