当我在 alpine linux 上安装 sshpass 时,它会安装,并且如果您在没有参数的情况下运行它,但使用任何参数(有效或无效)会返回sshpass: Failed to run command: No such file or directory
.
它是有路径的,即使使用绝对路径,它也具有相同的行为。我想将它与 ansible 一起使用,但它甚至不能直接工作。
我似乎无法在网上找到有关此功能或对其他人不起作用的任何信息,但我使用了其他人的容器和我自己的容器,但我无法让它在任何一个上运行。 https://pkgs.alpinelinux.org/package/v3.3/main/x86/sshpass
$ docker run -it --rm williamyeh/ansible:alpine3 ash
/ # sshpass
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
/ # sshpass hi
sshpass: Failed to run command: No such file or directory
/ # which sshpass
/usr/bin/sshpass
/ # /usr/bin/sshpass
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
/ # /usr/bin/sshpass anyinput
sshpass: Failed to run command: No such file or directory
值得一提的是,底层 ssh 可执行文件可以正常工作,我可以通过这种方式连接到主机。