The SCP command does not require a user password to be entered under Linux

Source: Internet
Author: User
Tags scp command

After you establish a secure trust relationship between the two users of the two machines, you do not need to enter the user's password when implementing the SCP command.

1. On the machine client, the root user executes the Ssh-keygen command to generate a certificate that establishes a secure trust relationship.

[Email protected] root]# ssh-keygen-b 1024-t rsagenerating public/private RSA key pair. Enter file in which to save the key (/ROOT/.SSH/ID_RSA): <– Direct Input Enter enter passphrase (empty for no passphrase): <– Direct output Into enter same passphrase again: <– Direct Input Enter your identification has been saved In/root/.ssh/id_rsa. Your public key have been saved In/root/.ssh/id_rsa.pub.the key fingerprint is: ...

  

Note: When the program prompts for passphrase, enter the carriage return directly, indicating that no certificate password is required.

The above command generates the private key certificate Id_rsa and the public key certificate id_rsa.pub, which is stored in the. SSH subdirectory of the user directory.

2. Copy the public key certificate id_rsa.pub to the. SSH subdirectory of the machine server's root directory, replacing the file name with Authorized_keys.

[Email protected] root]# scp-p ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys[email protected] ' s Password: <– Enter the root user password for the machine server

When executing the above command, the root user of the two machines has not established a secure trust relationship, so the root user password of the machine server is also required.

After the above 2 steps, a secure trust relationship is established between the root of the machine client and the root of the machine server. Here we look at the effect:

[Email protected] root]# scp-p text [email protected]:/root

  

It worked! You really don't need to enter your password anymore.

Note: Do not use the. SSH subdirectory of the user directory in the private key certificate Id_rsa and the public key certificate Id_rsa.pub deleted, otherwise it would not be good to make

The SCP command does not require a user password to be entered under 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.