When I install sshpass on alpine linux it will install and the doc will show up if you run it without arguments, but using any argument (valid or invalid) returns sshpass: Failed to run command: No such file or directory
.
It's pathed and even when using an absolute path it has the same behavior. I want to use this with ansible, but it won't even work directly.
I can't seem to find any information online about this functioning or not functioning for other people, but I used other people's containers and my own and I couldn't get it to function on either.
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
It's worth mentioning that the underlying ssh executable works and I can connect to the host that way.
Best Answer
SSHpass was working fine, but the alpine container python:3.6-alpine doesn't have openssh installed.
This errormessage is confusing as it doesn't mention that the ssh component is failing.
This can be fixed by running
apk add --update openssh
.This was resolved by changing the line in the Dockerfile from
RUN apk add --update --no-cache sshpass
toRUN apk add --update --no-cache openssh sshpass
.