centos下使用shell+expect远程登录主机

# 安装expect
yum install expect

# 新建脚本文件running
#!/usr/bin/expect
spawn /usr/bin/ssh [email protected] -p 6666 # 用户名、IP地址、端口号自行设置
expect "password:"
send "remoteComputerPassword\r" # 密码请自行设置
expect efo
interact

# 授权
chmod 755 running

  

猜你喜欢

转载自www.cnblogs.com/ipyanthony/p/10478997.html
今日推荐