Re:Daniel J. Bernstein's ptyget toolset
by dangerface on Thursday April 21, 2022 @11:17AM
(#31110571)
Bit of an edge use case but I had a backup server that the ssh would only take a password from interactive keyboard wouldn't accept the password argument for scp. Something like this could have fixed the issue, I ended up just going for a different provider that allowed ssh keys.
[ Parent
| on HN ]
There is also sshpass, which allows non-interactive ssh password auth.
You can provide the password on the command line, or in an environment variable:
sshpass -p 'PASSWORD' ssh user@host /bin/id
SSHPASS=PASSWORD sshpass -e ssh user@host /bin/id
Not ideal, but if you're working with inflexible third parties who don't understand public keys, sometimes it's acceptable.Storing secrets in environment variables is a common practice in many mostly-reasonable orgs.
Re:Daniel J. Bernstein's ptyget toolset
by bruce_one on Thursday April 21, 2022 @06:37PM
(#31116042)
OpenSSH also supports using a script to get the password if using the `SSH_ASKPASS` environment variable, and being invoked under a non-tty input e.g.
{ echo '#!/bin/sh' ; echo 'echo my_password' ; } > password.sh # don't do it like this :-p
chmod +x password.sh
SSH_ASKPASS=./password.sh DISPLAY= setsid ssh user@host /bin/id
In newer SSH versions `DISPLAY` is not required (but there is a new `SSH_ASKPASS_REQUIRE` environment variable), but in older (e.g. 8.x) versions, then it needs to be set as the default ssh-ask-password was an X11 command, and I believe the logic assumed that scenario.