|
If you are a client Linux Client, Server for the server, user name user. Now you want to configure from Client to Server SSH login without password.
1: generate a pair of keys on the Client, execute ssh-keygen command, where you need to enter directly Enter to accept the default values, 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, in /home/user/.ssh directory, there are a pair of keys id_dsa and id_dsa.pub.
2: When the Server public key id_dsa.pub in any way to upload, such as:
[User @ Client .ssh] $ scp id_dsa.pub Server: / home / user
3: Log on to the Server, execute the following command
cat id_dsa.pub >> /home/user/.ssh/authorized_keys
This completes the configuration, then log in Server from Client, no need to enter the password. This form is secure, you totally do not worry about other people from other machines can no password Server. This basic principle is this:
id_dsa and id_dsa.pub you generate in the client is a pair of keys, only the private key to unlock id_dsa public key id_dsa.pub. Now you put the public key exists on the server, your login server, the server will provide through public key id_dsa.pub (the contents of which exist in authorized_keys) allows you to decrypt the encrypted data using the private key id_dsa it on your machine, to decrypt, and then unlock Server release. And other people's machines did not id_dsa this private key, they can not decrypt, and thus can not log on without a password.
Of course, you want to ensure the safety of your private key on the machine. Otherwise, if someone else has made your private key, like others he made your room key, and then you can take your family to open the door. |
|
|
|