Tuesday, February 23, 2010

sudo: sorry, you must have a tty to run sudo

running a rather complex command through ssh :

# ssh user@remotebox "sudo su - user2 -c remotecommand"


gives me the following error:

sudo: sorry, you must have a tty to run sudo


fortunately sudo offers the option -t for a pseudo terminal allocation
and the instruction

# ssh -t user@remotebox "sudo su - user2 -c remotecommand"



now works perfectly

No comments: