Plugins requiring sudo

Some commands require sudo privileges to run. The agent runs under the user sd-agent which is a regular, unprivileged user which means you need to specifically run commands in your plugin code using sudo.

This can be done using something like subprocess in Python (note: lsof is used as an example so you should replace with the relevant command):

Popen(['sudo', 'lsof', 'arg1', 'arg2'])

You also need to modify the /etc/sudoers (using visudo) file to allow the agent to run this command:

sd-agent ALL=(ALL) NOPASSWD: /usr/sbin/lsof

And finally comment out this line in the sudoers file because the agent does not run with a TTY:

#Defaults    requiretty

Official Plugins Requiring sudo


Our official postfix plugin requires sudo to function. Here's an example for your sudoers file: 

sd-agent ALL=(ALL) NOPASSWD: /usr/bin/find 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.