5.和远程服务做免密

/usr/bin/expect <<EOF
spawn ssh-copy-id  -id  /root/.ssh/id_rsa.pub   用户@ip  -o StrictHostKeyChecking=no
expect {
 "(yes/no)" { send "yes\r"; exp_continue }
 "Password:" { send "密码\r" }
}
expect eof
EOF

 

posted on 2022-04-13 15:55  太白金星有点烦  阅读(26)  评论(0)    收藏  举报

导航