Configure ssh password-less logon-Linux Enterprise Application-Linux server application information. The following is a detailed description. Assume that the client is a client, the server is a server, and the user name is user. Now you need to configure password-free SSH login from the Client to the Server.
1. Generate a key pair on the Client and run the ssh-keygen command. Press enter directly to accept the default value. The output is as follows:
[User @ Client. ssh] $ ssh-keygen-d
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/. ssh/id_dsa ):
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/home/user/. ssh/id_dsa.
Your public key has been saved in/home/user/. ssh/id_dsa.pub.
The key fingerprint is:
22: 0c: 2e: 64: 09: 2e: a9: f1: 37: c5: ee: d9: e5: 57: 92: b4 user @ Client
At this time, there is a pair of keys id_dsa and id_dsa.pub under the/home/user/. ssh directory.
2: when the public key id_dsa.pub is uploaded to the Server in any way, for example:
3: log on to the Server and run the following command:
Cat id_dsa.pub>/home/user/. ssh/authorized_keys
This completes the configuration. At this time, you do not need to enter a password when logging on to the Server from the Client. This method is safe, so you do not have to worry that other users can log on to the Server without a password from other machines. The basic principle is as follows:
Id_dsa and id_dsa.pub generated on the client are a pair of keys. Only id_dsa with the private key can unbind the Public Key id_dsa.pub. Now you have stored the public key on the server. When you log on to the server, the server will provide you with data encrypted by the Public Key id_dsa.pub (whose content exists in authorized_keys) for decryption, use the id_dsa private key on your machine to decrypt the key. Then, the Server releases the key. If the id_dsa private key is not available on other machines, it cannot be decrypted and thus cannot be logged on without a password.
Of course, you must ensure the security of the private key on your machine. Otherwise, if someone else gets your private key, it's like someone else gets the key to your room, and then you can take it to open your door.
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