Search code examples
monofastcgifabric

tty a must to run sudo in fabric. How to overcome this?


I uses fabric to run a fastcgi_mono service via the command:

sudo('/etc/init.d/fastcgi_mono restart', pty=False)

But when I execute it, it gives me this error:

[52.192.204.174] run: sudo /etc/init.d/fastcgi_mono restart
[52.192.204.174] out: sudo: sorry, you must have a tty to run sudo
[52.192.204.174] out: 


Warning: run() received nonzero return code 1 while executing 'sudo /etc/init.d/fastcgi_mono restart'!

how do I solve this issue? Please help.


Solution

  • Yes I found the answer. For Amazon instances, you need to disable requiretty

    comment('/etc/sudoers', 'Defaults    requiretty', use_sudo=True)