Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Shell script enables ssh-copy-id to automatically send public keys to remote hosts in batches

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Demand

Batch realization of automatically sending public key to remote host

Environment

Firewalld: off

Selinux: off

Sshpass command shell calls the expect command sshpass command #! / bin/bash##****#Author: hechunping#QQ: × × # Date: 2019-11-07#FileName: ssh-sshpass.sh#URL: hexiaoshuai.blog.51cto.com#Description: The test script#Copyright (C): 2019 All rights reserved#*** * NET=172.20.200USER= (root hechunping) PASSWORD=123456ssh-keygen-t rsa-P''- f ~ / .ssh/id_rsa & > / dev/nullsed-I'/ StrictHostKeyChecking/c StrictHostKeyChecking no' / etc/ssh/ssh_configrpm-Q sshpass & > / dev/null | | yum-y install sshpass & > / dev/nullfor I in {1.. 254} Do {sshpass-p $PASSWORD ssh-copy-id-I ${USER [0]} @ ${NET}. ${I} & > / dev/null} & donewaitshell calls the expect command #! / bin/bash##* * # Author: hechunping#QQ: × × × # Date: 2019-11-07#FileName: ssh-expect.sh#URL: hexiaoshuai.blog.51cto.com#Description: The test script#Copyright (C): 2019 All rights reserved#** * * NET=172.20.200USER= (root hechunping) PASSWORD=123456ssh-keygen-t rsa-P''- f ~ / .ssh/id_rsa & > / dev/nullfor I in {1.. 254} Do {expect

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report