Linux_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 also sets the appropriate permissions for the remote host's user home directory (home) and ~/.ssh, and ~/.ssh/authorized_keys.

Step 1: Create a public key and key on the local host with Ssh-key-gen
[Email protected]$ ssh-keygen-t RSA
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 has been saved In/home/jsmith/.ssh/id_rsa.
Your public key has 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 to 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 to the machine, with―ssh. Remote-host ' ‖, and check in:
. Ssh/authorized_keys to make sure we haven ' t added extra keys, you weren ' t expecting.
[Note: Ssh-copy-id appends 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-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]

Then do what you need to do, like copy{.

Scp-r-P crawler-general/[email protected]:/home/crawler/
Scp-r-P crawler-general/[email protected]:/home/crawler/
Scp-r-P crawler-general/[email protected]:/home/crawler/
Scp-r-P crawler-general/[email protected]:/home/crawler/
Scp-r-P crawler-general/[email protected]:/home/crawler/

}

Linux_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.