Set password-free logon for ssh and password-free logon for ssh
Hypothesis:
-> Host A of the operating machine must log on to machine B and machine C without A password as user1?
User user1 is created on machine B and machine C and can be logged on through ssh.
Machine A settings:
1. Install the ssh service. Here
2. # ssh-keygen-t rsa-p''
Auto generate ~ /. Ssh/id_rsa and ~ /. Ssh/id_rsa.pub files.
Machine B and machine C settings:
1. Install the ssh service. Here
2. Modify/etc/ssh/sshd_config to find the ssh configuration file, and enable PubkeyAuthentication yes.
3. append the id_rsa.pub file generated on server A to the user1/. ssh/authorized_keys file on server B and server C. If the file is not manually created, you can use it.
The preceding settings for machine B and machine C can also be performed on machine A as follows:
Ssh-copy-id-I ~ /. Ssh/id_rsa.pub user1 @ ip address of server B
Restart the sshd service.
A password-free logon to machine B:
Ssh user1 @ B press Enter.
C is the same as above.
Related unsuccessful logs:/var/log/secure of machine B or machine C
Ssh password-free settings
Set the. ssh directory to 700 and have the execution permission.
Set authorized_keys to 600. Otherwise, an error occurs.
For example
Ssh root @ localhost
Ssh does not require a logon password. How can I configure it?
Here is an example:
192.168.1.1 --- client
192.168.1.2 --- slave
First on 192.168.1.1
Ssh-keygen
Generate id_rsa id_rsa.pub
Copy the content in id_rsa.pub
Create the authorized_keys file in the/root/. ssh/directory of 192.168.1.2
Copy the content in id_rsa.pub of 192.168.1.1 to the authorized_keys file.
Then execute ssh-keygen on 1.2.
Copy the content in id_rsa.pub to/root/. ssh/authorized_keys at 192.168.1.1.
Now you can try it!