Set SSH Automatic Login (password-free, user name) 1. Create a public key and Public Key ssh-keygen-t rsa. Ignore any prompts and press enter to the end. 2. Copy the Public Key id_rsa.pub to the/home/username/. ssh directory of the remote machine and name it authorized_keys. Method 1: one step in place: scp ~ /. Ssh/id_rsa.pub username @ hostname :~ /. Ssh/authorized_keys Method 2: Copy scp ~ /. Ssh/id_rsa.pub username @ hostname :~ Log on to ssh username @ hostname and append cat id_rsa.pub>. ssh/authorized_keys by using various methods. If you are happy, copy it ~ Multiple remote hosts can be copied multiple times ~ If your local login user is the same as the remote login user, you can directly log on to the ssh hostname directly. 3. Solve the inconsistency between the local login user and the remote login user. Well, this is very difficult. Although you don't need to enter the password, you have to log in by Using ssh username @ hostname, which is quite uncomfortable, you know. In fact, the solution is also very simple (but my colleague told me that the old face is red), modify the local Login User ~ /. In the ssh/config file, if there is a wood, create one by yourself. The content is as follows: Host hostname user username Host hostname2 user username2, you can also log on to the local host by Using ssh hostname, which is inconsistent with the remote login username. Close.