Make sudo -S work with ssh -T

Glen Huang <[email protected]> Thu, 23 Jun 2022 13:03:24 +0800
Newsgroups gmane.comp.tools.sudo.user
Message-ID <[email protected]>
Hi,

I’m able to use sudo -S with ssh like this:

ssh -t $host 'echo pw | sudo -Sv && sudo echo 1’

However, if I simply change -t to -T

ssh -T $host 'echo pw | sudo -Sv && sudo echo 1’

sudo complains

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required

It seems in the latter case, the first sudo’s successful auth didn’t get extended to the second sudo.

The real issue I’m trying to solve is to allow rsync to use sudo without have to give it NOPASSWD:

rsync --rsync-path 'echo pw | sudo -Sv && sudo rsync’ $host:/

It seems the root cause should be the same.

I wonder how could fix the second case?

Regards,
Glen
____________________________________________________________
sudo-users mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-users