Once and for all? How to enable ssh without entering a password
Source: Internet
Author: User
Article Title: permanent? Do not enter a password for ssh. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Step 1: generate a key pair. I use the rsa key. Run the command "ssh-keygen-t rsa"
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] $
During the generation process, the system prompts you to enter the key pair storage location and press enter to accept the default value. Next, you will be prompted to enter a password different from your password. Press enter to leave it empty. You can also enter one. (I am too lazy to enter a password every time .) In this way, the key pair is generated.
The Public Key is stored in ~ /. Ssh/id_rsa.pub private key is stored in ~ /. Ssh/id_rsa
Then change the. ssh directory permission and run the command "chmod 755 ~ /. Ssh"
Code:
In this way, we are done. Then you can use ssh scp sftp to access the machine without entering the password. It is more convenient to use it on scripts.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service