当前位置: 代码迷 >> 综合 >> 黑猴子的家:auto-ssh-expect.sh
  详细解决方案

黑猴子的家:auto-ssh-expect.sh

热度:123   发布时间:2023-09-14 22:15:29.0

在/usr/local/bin 目录下

#!/bin/bashuser=`whoami`
passwd=000000#yum install -y sshpass expectfor((current=102; current<=104; current++));dofor((host=102; host<=104; host++));dosshpass -p $passwd ssh -q -o StrictHostKeyChecking=no $user@hadoop$current expect << EOFspawn ssh-copy-id ${user}@hadoop${host}expect {"yes/no" {send "yes\r";exp_continue}"password" {send "$passwd\r"}}expect eof
EOFdone
done
  相关解决方案