Last update at :2024-03-05,Edit by888u
Sometimes for security, or when you have many VPS to facilitate SSH remote login, you can configure an SSH public key and log in through the SSH public key to achieve password-free login to Linux VPS without having to enter the VPS password every time. Remote password. This article introduces SSH public keys, SSH public key generation methods, and how to configure SSH public keys to achieve SSH password-free login.
SSH and SSH public key
SSH, or Secure Shell, is simply a network protocol used for encrypted remote login between computers. This login method is safe. Even if it is intercepted midway, the password will not be leaked.
Every time you SSH, you need to enter the password of the target computer. The function of the SSH public key is to store the public key of your computer on the remote server. Through SSH public key authentication, you save the need to enter the password every time. Trouble. Ordinary SSH remote, GitHub code submission, etc. all support SSH public key authentication.
SSH password-free login
The following is an introduction to the steps to configure SSH password-free login. It is actually very simple. It is to generate an SSH public key on the local machine, and then copy the local SSH public key to the target VPS and configure authorized_keys to achieve SSH password-free login. Logged in.
1.SSH public key generation
Execute the following code on this machine to generate the SSH public key, and press Enter all the way to set the default settings:
ssh-keygenAfterwards, an id_rsa.pub file will be generated under /root/.ssh. This is your local SSH public key.
2. Copy the SSH public key file Copy your local SSH public key file to the remote VPS, then go to the /root/.ssh folder of the target VPS and write the local public key file just now into authorized_keys:
cat id_rsa.pub >> authorized_keys3. Password-free login
After that, you can log in without a password directly through ssh user@ip when remote, as shown in the figure below:
Recommended site search: IP purchase, Hong Kong high-defense server rental, free domain name, mainland China PHP space, server rental US high-defense, free server website telecom host rental, host server rental, server, public network ip,
p>
发表评论