ssh自动登录

set timeout -1
spawn ssh [email protected]
expect "*assword:"
send "qwer1234\r"

expect "*$ "
send "sudo su -\r"

expect "*assword*"
send "qwer1234\r"

expect "*# "
send "cd /usr/local/nginx/html/SDK/malacca_js/1.1/src/\r"

interact

你可能感兴趣的:(ssh自动登录)