Ssky-keygen + ssh-copy-id login remote Linux host without password

Source: Internet
Author: User

Using Ssky-keygen and Ssh-copy-id in the example below, you can log in to a remote Linux host with a simple setup of 3 steps without entering a password.
Ssh-keygen
Create public keys and keys.
The Ssh-copy-id copies the local host's public key to the remote host's Authorized_keys file.
Ssh-copy-id
The User home directory (home) and ~/.ssh, and ~/.ssh/authorized_keys for the remote host are also set to the appropriate permissions.

Step 1:
Using Ssh-key-gen to create public keys and keys on the local host

[Email protected]$ ssh-keygen-t RSA (or DSA)
Enter file in which to save the key (/HOME/JSMITH/.SSH/ID_RSA): [Enter
Key
Enter passphrase (empty for no passphrase): [Press ENTER key]
Enter
Same passphrase again: [Pess enter key]
Your identification have been saved in
/home/jsmith/.ssh/id_rsa.
Your public key have been saved in
/home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9

[Email protected]

Step 2: Use Ssh-copy-id
Copy the public key to the remote host

[Email protected]$ ssh-copy-id-i ~/.ssh/id_rsa.pub
[Email protected]
[email protected] ' s password:
Now try logging into the
Machine, with―ssh. Remote-host ' ‖, and check in:
. Ssh/authorized_keys to
Make sure we haven ' t added extra keys so you weren ' t expecting.
Note
Ssh-copy-id append the key to the. Ssh/authorized_key on the remote host.]

Step 3:
Log in directly to the remote host

[Email protected]$ ssh remote-host
Last Login:sun Nov 16
17:22:33 from 192.168.1.2
[Note: SSH does not ask for a password.]
[Email protected]$

[Note: You are now logged on to the remote host]

Ssky-keygen + ssh-copy-id login remote Linux host without password

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.