According to this RedHat SSH password automation guide I'm following the Example 4: GPG one, and following the steps in that guide I create my pass_file using my own passphrase. Then, I got this:
gpg -d -q myappserver23.sshpasswd.gpg > pass_file && sshpass -fpass_file ssh [email protected]
Note the lack of a space between the -f option and pass_file according to sshpass man page
When I run the command above, I'm asked for my passphrase, I type it correctly and then I'm asked for the server's password as if sshpass wasn't even used.
In short, this works but I still got a password prompt...
I'm aware of the -q options certainly and I've added also -vvv to both sshpass and ssh and it seems this is related to shh and not to sshpass I believe.
I'll just share here the debug messages I got after the ssh banner message
(...)
debug3: input_userauth_banner
----------------------------------------------------------------------------------------
Here goes ssh banner message
----------------------------------------------------------------------------------------
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\myuser/.ssh/id_rsa RSA SHA256:7PAz6lsENYkfYGwFZWNf0OJ88Z9mFDMSBc+P9t+4H1k
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_dsa
debug3: no such identity: C:\\Users\\myuser/.ssh/id_dsa: No such file or directory
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_ecdsa
debug3: no such identity: C:\\Users\\myuser/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_ed25519
debug3: no such identity: C:\\Users\\myuser/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_xmss
debug3: no such identity: C:\\Users\\myuser/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password:
The last line of this output is the password prompt. Obviously, if I type my password here, I'll be able to login to the remote server but then, what's the point to use sshpass ? I'd like to be able to just login without having to type any password.
Please, don't advise the use of private keys, I know about the subject but its not applicable to my real world scenario. Any help will be appreciated.