expect或者sshpass
eg.
【expect】
#!/usr/bin/expect -f
set password 123456
#download
spawn scp root@192.168.1.218:/root/a.wmv /home/yangyz/
set timeout 300
expect "root@192.168.1.218's password:"
set timeout 300
send "$password\r"
set timeout 300
send "exit\r"
expect eof
【sshpass】
# sshpass -p 'ssh_password' ssh $hostname
阅读(666) | 评论(0) | 转发(0) |