Quite often scripts that are performed by non-privileged users (as they always should where possible) will need to perform a privileged action such as reload a service.
In order to do this 'as securely' as possible we can employ sudo - and telling sudo that the user can run the command xyz as the 'root' user and nothing else.
To do this we need to edit the sudoers file:
vi /etc/sudoers
and add the following line
myusername ALL = (root) NOPASSWD: /usr/sbin/service myservice reload
No comments:
Post a Comment