How to set up SSH password-free login, just two steps (even beginners can learn it)

SSH password-free login allows users to log in to remote servers without entering a password, improving login efficiency and security. The following are the steps for SSH password-free login:

Generate public and private keys

Use the ssh-keygen command on your local computer to generate public and private keys. By default, these files will be stored in the ~/.ssh directory.

$ ssh-keygen

Copy the public key to the remote server

Copy the public key to the remote server using the ssh-copy-id command. If this command is not installed, you can manually add the public key content to the remote server's ~/.ssh/authorized_keys file.


$ ssh-copy-id username@remote_server

Test password-free login

You should now be able to log in directly to the remote server via the ssh command without entering a password:

$ ssh username@remote_server

If everything is normal, you have successfully implemented SSH password-free login.

Guess you like

Origin blog.csdn.net/yueyeguzhuo/article/details/130047635