Use the SSH public key (id_dsa.pub) for password-free login

Source: Internet
Author: User
First, generate the public key on the local machine: Java code [root@localhost.ssh] # ssh-keygen-d always press the Enter key Generatingpublic/privatedsakeypair. enterfileinwhichtosavethekey (/root /. ssh/id_dsa ):...

First, generate a public key on the local machine:
Java code
[Root @ localhost. ssh] # keep pressing the enter key for ssh-keygen-d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/. ssh/id_dsa ):
/Root/. ssh/id_dsa already exists.
Overwrite (y/n )? Y
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/root/. ssh/id_dsa.
Your public key has been saved in/root/. ssh/id_dsa.pub.
The key fingerprint is:
89: 77: aa: a2: d8: 31: 35: 1e: 3a: 34: 9e: b9: da: ea: 62: 34 root@localhost.localdomain
[Root @ localhost. ssh] #


Then, upload the generated public key to the remote machine that you want to log on to. if the root user logs on remotely, put the public key under the/root/. sshd directory.
Java code
[Root @ localhost. ssh] # scp/root/. ssh/id_dsa.pub root@192.168.0.60:/root/. ssh/
Root@192.168.0.60's password: Enter the login password for the remote machine
Id_dsa.pub 100% 616 0.6KB/s

And modify the file name:
Java code
[Root @ web1. ssh] # mv id_dsa.pub authorized_keys

Finally, ssh password-free login is implemented.

SSH password-free login:

Java code
[Root @ localhost. ssh] # ssh root@192.168.0.60
Last login: Tue Sep 27 09:03:10 2011 from 192.168.0.3
[Root @ web1 ~] #

Author: "birds of heaven"
 

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.