[svc][op]ssh交互yes问题解决-expect
Expect是Unix系统中用来进行自动化控制和测试的软件工具
C67默认未安装:使用需要安装:
yum install expect -y
which expect #查看安装路径
核心命令:
[root@moban shells]# cat t.exp #!/usr/bin/expect spawn ssh-copy-id -i /root/.ssh/id_dsa.pub 192.168.14.160 expect { "yes/no" {send "yes\r";exp_continue} "password" {send "123456\r"} } expect eof exit -onexit { send_user "good bye!!!" }
exp文件后缀便是expect:
以下是ssh-key-gen的一个自动化expect.
核心命令仅几条:
spawn为执行命令语句: