1

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.

  • what's the output of sshpass ls? – pynexj Jan 16 '18 at 3:27
  • $ docker run -it --rm williamyeh/ansible:alpine3 sshpass ls bin etc lib mnt root sbin sys usr dev home media proc run srv tmp var – Brian Jan 17 '18 at 1:34
  • so it's working fine. – pynexj Jan 17 '18 at 2:10
3

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 to RUN apk add --update --no-cache openssh sshpass.

1

No such file or directory refers to hi and anyinput :)

I just installed sshpass on an alpine virtual machine and

# sshpass -p <my password> ssh 127.0.0.1

works as expected.

PS: I am sure you know what you are doing and stuff, but please make sure you have looked into public key authentication before reaching for things like sshpass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.