expect command to realize ssh automatic login

#!/usr/bin/expect
set USER [lindex $argv 0]
set IP     [lindex $argv 1]
set PASSWD [lindex $argv 2]

spawn ssh $USER@$IP
expect {
	"*yes/no*" { send "yes\r" }
	"*password:" { send "$PASSWD\r" }
}
interact

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326988769&siteId=291194637