Linux study notes - SSH password-free login

  
        

Need to achieve:

 There are two servers: "192.168.201.236" and "192.168.201.237" Need to implement: implement ssh on server "192.168.201.236" Password Connection Server "192.168.201.237"

Implementation Steps:

1) Use the "ssh-keygen -t rsa" command on the "192.168.201.236" server to create the public key. (I will ask you to store the directory, if you do not need to modify, you can directly press Enter twice, the default save path is "~/.ssh/")


2) will be the first step The generated "~/.ssh/id_rsa.pub" file is copied to the "192.168.201.237" server"~/.ssh/" directory and renamed to "authorized_keys". 


3) Modify the "192.168.201.237" server"~/.ssh/" directory permissions to 700, "~/.ssh/authorized_keys" file permissions to 600. (This is the security requirement of linux. If the permissions are not correct, the automatic login will not take effect.) 


4) Connect to 192.168.201.237 with the ssh command on the "192.168.201.236" server "Server. (As shown below, the connection is successful. Note: 30330 is the 237 server port.) 


You may also be prompted for a password:

1) If an alarm occurs: " ;Address XXXX maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!". Execute the following command on the "192.168.201.236" (connected) server: echo "GSSAPIAuthentication no" >> ~/.ssh/config is executed on the "192.168.201.237" (connected) server "vi /etc/ssh/sshd_config" command, modify the following two values ​​as "no" :"GSSAPIAuthentication no" "UseDNS no" 
2) If an alarm occurs: "Agent admitted failure to sign using The key."execute command: "ssh-add" (add the private key to the ssh-agent cache) If not, execute the command: "ps -Af 
						
Copyright © Windows knowledge All Rights Reserved