Linux server scp does not require password configuration

Source: Internet
Author: User
Linux server scp does not require password configuration case: ▲ server A performs ssh connection to server B and server C, do not enter A password or www.2cto.com ▲ server A Copies files to server B and server C (the source file is on server A). do not enter A password for host A: 192.168.0.221 host B: 192.168.0...
Linux server scp does not require password configuration case: ▲ server A performs ssh connection to server B and server C, do not enter A password or www.2cto.com ▲ server A Copies files to server B and server C (the source file is on server A). do not enter A password for host A: 192.168.0.221 host B: 192.168.0.227 host C: 192.168.0.228 1. run the command script on each server (host A, host B, and host C are all executed to generate the public key and private key) mkdir-p ~ /. Ssh chmod 700 ~ /. Ssh/usr/bin/ssh-keygen-t rsa) 2. then, you need to execute (target host B and C) touch ~ on the host to be distributed in batches ~ /. Ssh/authorized_keys Method 1: ssh 192.168.0.221 cat ~ /. Ssh/id_rsa.pub> ~ /. Ssh/authorized_keys (the command above indicates that the file on the server 192.168.0.221 (host A) is ~ The content of/. ssh/id_rsa.pub is appended to the local (host B, C) file ~ /. Ssh/authorized_keys description: 192.168.0.221 is the IP address of the distribution host (source host A) root@192.168.0.221's password: xxxxx (enter the password when you need to enter the password) method 2 (also A simple method): directly log on to the server 192.168.0.221 (host A) and run the command cat ~ /. Ssh/id_rsa.pub view the content (public key), copy and append the content to the files of host B and host C ~ /. Ssh/authorized_keys 3. execute the command on the host to be distributed (target host B, C) www.2cto.com chmod 600 ~ /. Ssh/authorized_keys 4. verify on the distribution host (source host) connect from host A to host B test ssh 192.168.0.227 connect from host A to host C test ssh 192.168.0.228 5. common scp on distribution host (source host. sh file, usually set the file to the scheduled script/etc/crontab, or manually execute it separately. Distribute files scp-r/usr/local/adsit/webapps/preroll/WEB-INF/classes root@192.168.0.227 from the distribution host 192.168.0.221 to 192.168.0.227 and 192.168.0.228: /home/adsit/scp-r/usr/local/adsit/webapps/preroll/WEB-INF/classes root@192.168.0.228:/home/adsit/execute scp on the distribution host. sh implements the Copy function.
Related Article

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.