In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to make ssh login without entering password". In daily operation, I believe that many people have doubts about how to make ssh login without entering password. Xiaobian consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to make ssh login without entering password". Next, please follow the editor to study!
Sometimes we use scp when copying / moving files to another machine because it is more secure. But if you have to enter a password every time, it will be more annoying, especially in script. However, ssh has another way to authenticate with key pairs. The following is my process of generating key pairs for your reference.
Step 1: generate a key pair. I use the key of rsa. Use the command "ssh-keygen-t rsa"
[Copy to clipboard] [-] CODE: [user1@rh user1] $ssh-keygen-t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/ home/user1/.ssh/id_rsa):
Created directory'/ home/user1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in / home/user1/.ssh/id_rsa.
Your public key has been saved in / home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
E0:f0:3b:d3:0a:3d:da:42:01:6a:61:2f:6c:a0:c6:e7 user1@rh.test.com
[user1@rh user1] $
In the process of generation, you are prompted to enter the location where the key pair is saved, enter directly and accept the default value. Then you will be prompted to enter a password that is different from your password, enter directly and leave it empty. Of course, you can also enter one. I am lazy and don't want to enter my password every time.) In this way, the key pair is generated.
Where the public key is stored in ~ / .ssh/id_rsa.pub
The private key is stored in ~ / .ssh/id_rsa
Then change the permissions of the .ssh directory and use the command "chmod 755 ~ / .ssh"
[Copy to clipboard] [-] CODE: [user1@rh user1] $chmod 755 ~ / .ssh
[user1@rh user1] $
Then copy the public key in this key pair to the machine you want to access and save it as ~ / .ssh/authorized_keys.
[Copy to clipboard] [-] CODE: [user1@rh user1] $scp ~ / .ssh/id_rsa.pub rh2:/home/user1/.ssh/authorized_keys
User1@rh2's password:
Id_rsa.pub 100% 228 3.2MB/s 00:00
[user1@rh user1] $
In this way, we are done. After that, when you use things like ssh scp sftp to access that machine, you don't have to enter your password, which is even more convenient for script.
At this point, the study on "how to make ssh login without entering a password" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.