SSH key authentication and SSH SCP without input password implementation

Source: Internet
Author: User
Tags ssh scp command

Often in the Linux between the SCP command transmission files, each time the need to enter the other machine password, very troublesome. This approach allows both parties to automatically pass the key authentication without having to enter the password manually:

1,root Landing, on both sides of the machine execute the following command and return all the way to generate the RSA private key and public key:

[root@ ~]# CD. SSH

[root@. ssh]# ssh-keygen-t RSA

Generating public/private RSA key pair.

Enter file in which to save the key (/ROOT/.SSH/ID_RSA):

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved In/root/.ssh/id_rsa.

Your public key has been saved in/root/.ssh/id_rsa.pub.

The key fingerprint is:

E7:ad:46:67:45:1a:df:da:cd:c7:32:e3:bf:76:8e:a9

2, on both sides of the machine view/root/.ssh, found that all generated two files: Id_rsa, id_rsa.pub, Id_rsa for the private key, id_rsa.pub for the public key:

[root@. ssh]# ll

Total 32

-RW-------1 root 1675 Aug 22:09 Id_rsa

-rw-r--r--1 root root 415 Aug 22:09 id_rsa.pub

-rw-r--r--1 root root 222 Aug 8 22:52 known_hosts

3, on both sides of the machine/root/.ssh/directory to establish Authorized_keys files, and the other party's public key id_rsa.pub file contents of the test to Authorized_keys, so that can be implemented without the password transfer file.

4, if more than one machine, the other machine's public key file content appended to the local Authorized_keys file, can be implemented locally to the other machine without entering a password.

This article from the "Small Hebebe Technical Space" blog, please be sure to keep this source http://babyhe.blog.51cto.com/1104064/636752

See more highlights of this column: http://www.bianceng.cn/OS/Linux/

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.