I'm in the process of fixing a script which fails because it invokes sudo in an environment without a pty which has a sudoers file defining Default requiretty.
The script is executed by root and uses sudo to call binaries which depend on being executed by specific users, so my solution was to replace those sudo by su.
Now I want to test my modifications, but I have a hard time reproducing the environment where sudo failed :
I can access the machine through another user, then log as root with
sudo su -. I don't knowroot's password.I know how to access the machine without a pty with
ssh -T, but then I can't log as root anymore becausesudofails.
How could I get a root shell without pty ?
sudo su -or making itNOPASSWDshould do the trick. I will try this out.