In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
 
            
                     
                
2025-11-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
What this article shares with you is the method of shell to achieve batch key-free login. I believe most people have not yet learned this skill. In order to let you learn, I have summarized the following content for you. Without saying much, let's move on.
Note: ip.txt and send_ssh_key.sh must be in the same root directory
# write server information ip.txt according to the following format for key-free login #-# ipgroup passwordholders 192.168.1.110 VRV 7758521mm 192.168.1.111VOR 7758521VOG 192.168.1.112Rd 7758521pin ssh keyif # generate ssh keyif [!-f "/ root/.ssh/id_rsa"] Then echo "gen ssh key" ssh-keygen-t rsa-b 2048-N'- f / root/.ssh/id_rsafi# checks if expectif is installed! Expect-v & > / ipfor p in $(cat ip.txt | grep-v'#') in the dev/null;then echo "install expect" yum install expect-yfi# loop file Do ip=$ (echo "$p" | cut-F1-d ":") # take out the current IP password=$ (echo "$p" | cut-f2-d ":") # take out the current password # expect interactive process expect-c "spawn ssh-copy-id-I / root/.ssh/id_rsa.pub root@$ip expect {\" * yes/no*\ "{send\" yes\ r\ " Exp_continue}\ "* password*\" {send\ "$password\ r\"; exp_continue}\ "* Password*\" {send\ "$password\ r\";}} "
After reading this article, have you learned the method of batch key-free login with shell? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about

The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r


A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from

Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





 
             
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.