[sudo-users] Password handling through remote SSH session
gtaylor at tnetconsulting.net
Wed Aug 14 21:59:59 MDT 2019
On 8/14/19 12:10 PM, Gabe Alford wrote:
> I have a QT application that logs into a remote machine through SSH. I
> need to handle password authentication in sudo to run administrative
> commands. What's the best way of handling a password prompt remotely
> with sudo? I would like to have the QT application just pass the
> password to sudo in some way so there is still human interaction
> involved. Just not sure what is the best way or if there is a
> programatic way.
If your Qt application is doing something like expect screen scraping,
I'm betting that it is also using a standard OpenSSH client. (Unless
it's using something more Qt specific or framework.)
That probably means that it's launching OpenSSH directly which means
that there likely is not a PTY which I'm fairly certain that sudo wants.
You can pass a single "-t" to OpenSSH's client to cause it to create and
use a PTY /if/ the client sees one locally.
You can pass two "-t"s to OpenSSH's client to cause it to create and use
a PTY even if there isn't one locally.
Aside: I've configured all of my OpenSSH clients to use the "-t"
functionality because I think it helps.
I think "-t" or "-tt" will likely help your existing code to interface
with a remote sudo.
Grant. . . .
unix || die
More information about the sudo-users