閱讀805 返回首頁    go 阿裏雲 go 技術社區[雲棲]


linux 批量更改shell


摘要:linux 批量更改密碼腳本執行**

批量關機 shell

k=226
for i in `seq 101 150`

do

/usr/bin/expect << EOF
spawn ssh bfadmin@192.168.100.$i
expect "~$ "
send "sudo reboot\r"
expect "password"
send "password\r"

EOF
done

批量改密碼

for i in `seq 106 130`
do
/usr/bin/expect << EOF
set timeout 150
spawn ssh bfadmin@192.168.100.$i
expect "*$ "
send "sudo passwd bfadmin\r"
expect "sudo"
send "password"
expect "Enter"
send "password\r"
expect "Retype"
send "passwordnew\r"
expect "*$ "
send "exit\r"
EOF
done

最後更新:2017-05-23 14:32:44

  上一篇:go  Java IO: System.in, System.out, System.err
  下一篇:go  《Java特種兵》1.4 功底概述