1:sshpass下载地址(用yum安装不了) https://sourceforge.net/projects/sshpass/files/ or wget http://sourceforge.net/projects/sshpass/files/latest/download -O sshpass.tar.gz 2:下载后,解压,安装 tar -zxvf sshpass-1.06.tar.gz cd sshpass-1.06 ./configure make make in
1:简单的实现ssh登录 #!/usr/bin/expect set ip "10.0.0.142" set user "root" set password " spawn ssh $user@$ip expect { "yes/no"{ send "yes\n";exp_continue } "password:"{ send "$password\r"} } intera