#!/bin/bash
ip="$1"
pawd="123qwe!@#"
expect << EOF
set timeout 10
spawn ssh-copy-id -p60022 root@${ip}
expect {
"yes/no" {send "yes\n"; exp_continue}
"password:" {send "${pawd}\n"}
}
send "exit\n"
expect eof
EOF
检测
ssh -p60022 [email protected]
标签:免密,p60022,pawd,send,expect,linux,ssh From: https://www.cnblogs.com/qiuxp/p/17633487.html