您的位置:首页 > 运维架构 > Linux

远程创建用户的脚本

2016-12-16 22:14 429 查看
#!/usr/bin/expect
set IP [lindex $argv 0]
set PASS [lindex $argv 1]
spawn ssh root@$IP useradd dingdangmao -p 'westos'
expect{
yes/no
{send "yes\r";exp_continue}
"password:"
{send "$PASS\r"}
}
interact

#!/usr/bin
for x in {248..249}
do
ping -c1 -w1 172.25.254.$x &> /dev/null && ( /mnt/check_user.exp) 172.25.254.$x redhat) ||

(echo 172.25.254.$x is down)
done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux