#!/usr/bin/expect set timeout 10 set username [lindex $argv 0] set password [lindex $argv 1] set hostname [lindex $argv 2] spawn ssh-copy-id -i /root/.ssh/id_rsa.pub
|
chmod 777 auto_ssh.sh然后执行下述命令即可。./auto_ssh.sh root 123456 192.168.10.162
试验结果:
162机器上传看:成功!