[sudo-users] Make sudo -S work with ssh -T

Glen Huang heyhgl at gmail.com
Wed Jun 22 23:03:24 MDT 2022


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


More information about the sudo-users mailing list