Scp batch upload public key

Source: Internet
Author: User
Scp batch upload public key #! /Bin/bashcat/root /. ssh/id_rsa.pub & gt;/root. ssh/authorized_keys: import the public key to the auth file to host1 'cat/root/a' # The content in file a is the target host address foriin $ ho you want the scp public key... scp batch upload public key #! /Bin/bash cat/root /. ssh/id_rsa.pub>/root. ssh/authorized_keys: import the public key to the auth file host1 = 'cat/root/a' # The content in file a is the target host address of the scp public key you want. for I in $ host1; do command1 = "scp/root /. ssh/authorized_keys $ I:/root /. ssh/authorized_keys "keep CT-c" set timeout 60; spawn $ command1; keep Ct {\ "(yes/no )? \ "{Send \" yes \ r \ "; exp_continue} \" $ I's password: \ "{send \" leezqang \ r \"; exp_continue }## send is the password. this method has a limit that the passwords of all target hosts must be consistent. if the passwords are inconsistent, you can define an array to complete this function} "done www.2cto.com
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.