1.先安装expect:
yum install expect
2. 写个shell脚本SSHLoginRemote.sh :
#!/usr/bin/expect
spawn ssh root@192.168.4.2
expect "*password:"
send "sophnep!@#\r" #user password
expect "*#"
interact
3.直接运行SSHLoginRemote.sh:
./SSHLoginRemote.sh
1.先安装expect:
yum install expect
2. 写个shell脚本SSHLoginRemote.sh :
#!/usr/bin/expect
spawn ssh root@192.168.4.2
expect "*password:"
send "sophnep!@#\r" #user password
expect "*#"
interact
3.直接运行SSHLoginRemote.sh:
./SSHLoginRemote.sh
© 著作权归作者所有