无法执行"ssh":没有这样的文件或目录



我正在尝试使用期望脚本,以便从我的容器ssh到外部设备。我正在使用docker和CentOS安装在该容器上。

脚本很简单:

#!/usr/bin/expect -f
set timeout 60
set cmd "ssh edi@192.168.0.249"
#spawn {*}$cmd
spawn ssh edi@192.168.0.249
set timeout 30
expect "yes/no" {
send "yesr"
expect "*?assword" { send "adminr" }
} "*?assword" { send "adminr" }
expect "$ " { send "mkdir TEST1r" }
interact

但是每次我尝试运行时,我都会遇到这个错误:

[root@cacti]# expect test.expect 
spawn ssh edi@192.168.0.249
couldn't execute "ssh": no such file or directory
while executing
"spawn ssh edi@192.168.0.249"
(file "test.expect" line 9)
[root@cacti]# expect -c "spawn ssh 192.168.0.249"
spawn ssh 192.168.0.249
couldn't execute "ssh": no such file or directory
while executing
"spawn ssh 192.168.0.249"

我甚至尝试从bash脚本调用expect脚本,结果是相同的。请帮助我,因为我找不到关于这方面的任何信息。

正如您所指出的,ssh没有安装,yum也不能工作。我已经找到了一个解决方法,通过安装rpm,我已经手动转移到容器。

openssh - 8.0 p1 - 5. - el8.src.rpmopenssh - 8.0 p1 - 5. - el8.x86_64.rpmopenssh -客户- 8.0 p1 - 5. el8.x86_64.rpmsshpass - 1.06 - 8. - el8.x86_64.rpm

rpm -i安装它们

最新更新