I wrote a Ruby script that runs as a daemon on a Linux server and periodically executes
sudo env PATH=$PATH "/usr/local/bin/passenger-status"
and logs the result to a text file. Everything works as expected.
My issues arise when requiretty
in sudoers is enabled.
Once requiretty
is enabled
sudo env PATH=$PATH "/usr/local/bin/passenger-status"
does not return anything when the script is running as a daemon. If the script is not run as a daemon, everything works as expected again.
What is the relationship between requiretty
in sudoers and daemon processes? How do I properly enable requiretty
in sudoers and get the expected behavior out of a daemon process?