This article is based on centos (4) iptables's LAN environment, and configures ssh Automatic Logon for multiple machines in the LAN. There are already a lot of ssh configuration files on the network. This article also uses the same method, mainly to analyze and sort out some problems encountered, hope to be useful to yourself and others. First
This article is based on centos (4) iptables's LAN environment, and configures ssh Automatic Logon for multiple machines in the LAN. There are already a lot of ssh configuration files on the network. This article also uses the same method, mainly to analyze and sort out some problems encountered, hope to be useful to yourself and others. First
This article is inCentos (4) iptables build LAN environmentOn the basis of ssh automatic login configuration for multiple machines in the LAN.
There are already a lot of ssh configuration files on the network. This article also uses the same method, mainly to analyze and sort out some problems encountered, hope to be useful to yourself and others.
First, ssh-keygen is used to generate the public key and private key on the johnny-test-3 machine.
Then, use ssh-copy-id to copy the file to another machine:
The next step is to copy the/etc/ssh/ssh_config file ~ In the/. ssh/directory, name it config. If you use the default id_dsa, skip this step.
Then you can directly ssh to the johnny-test-2 machine.
Let's compare the content of authorized_keys and test3_dsa.pub on the johnny-test-2 machine, and we will find that they are actually the same.
Therefore, ssh-copy-id does two things: first, the local *. pub file of scp is uploaded to the target machine, and then cat *. pub> authorized_key is used.
Currently, there are three machines in the LAN. To allow any two machines to log on automatically, you only need to set the authorized_key file on one server, copy the file directly to all other machines.
I encountered a strange problem again. johnny-test-1 can be connected to other machines, and other machines can automatically log on to each other, but they cannot automatically log on to johnny-test-1.
Now we need to check the ssh log and use the root permission To view/var/log/secure. The following error will be found:
Next, compare johnny-test-1 ~ /. Ssh and other machine's ~ /. Ssh directory has the following permissions: too many. ssh directory permissions for johnny-test-1 will be found,
Johnny-test-1
Other machines
Use the following command:
Chmod 700 ~ /. Ssh
From other machines, we can automatically ssh to johnny-test-1.
Solve this problem