How does one skip the password when transferring files on a linux server?

Source: Internet
Author: User
How does one transmit files on a linux server without a password? in a Linux environment, the scp command is generally used to transmit files between two hosts, generally, when you use the scp command to obtain the file of the other linux host through ssh, you need to enter a password for confirmation. However, by establishing a trust relationship, you do not need to enter a password. Here... how does one transfer files on a linux server without having to enter a password? in a Linux environment, the scp command is usually used to transfer files between two hosts.
You must enter a password for ssh to obtain the files on the other linux host. However, by establishing a trust relationship, you do not need to enter a password. Assume that IP address A: 192.168.10.1 B's IP address: 192.168.10.2 needs to be copied from A without A password to B. 1. run the following command on host A to generate A pair Key: ssh-keygen-t rsa. follow the prompts and do not enter passphrase. The following message is displayed: 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: ff: 8e: 85: 68: 85: 94: 7c: 2c: 46: b1: e5: 2d: 41: 5c: e8: 9b root@localhost.domain 2. set. I in the ssh Directory Copy the d_rsa.pub file to the ~ of host B ~ /. Ssh/directory, and renamed it authorized_keys. Scp. ssh/id_rsa.pub 192.168.10.2:/root/. ssh/authorized_keys. after scp from host A to host B, no password is required. 3. when using this method, you must note that the two computers to be copied must use the same account name, and the root account is used here. For the sake of security, you need to create the same account on the two machines, and then switch to the account using the su command on the, and execute step 2. this is possible when copying files in step 2. the ssh directory does not exist and needs to be created manually. If the authorized_keys file already exists in the machine in step 1, you must note that this file can contain multiple SSH authentication information. in this case, you can use the cat> command to append the authentication file content. For example, copy to scp. ssh/id_rsa.pub 192.168.10.2:/root/. ssh/a. pub and then run cat ~ /. Ssh/a. pub> ~ /. Ssh/authorized_keys
 

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.