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 know root's password.I know how to access the machine without a pty with ssh -T, but then I can't log as root anymore because sudo fails.How could I get a root shell without pty ?
How can I obtain a shell without pty
bash;tty
First thing I'd try is to execute your script with at or cron. Example:at now <<< sudo echo 'This will fail if sudoers requiretty' 2>/tmp/stderr >/tmp/stdout 