0

We have an automatic script on one of our servers, run by observing-user. It needs to tell another script, run by primary-user, to update a log file.

The code for this is sudo kill -UPDATE_LOG pid

Obviously, observing-user has to have permissions to run this command. However, I don't want to give this automatic script permission to kill processes, for obvious reasons.

I would like to do something like alias update_log='kill -UPDATE_LOG; grant update_log on observing_user

1

2 Answers 2

0

probably using

sudo pkill -UPDATE_LOG <process-name>

instead of kill will be enough restrictive to meet your need?

Another way to adress this is to embed the command you want to offer with sudo in a custom script or exec to do this action.

0
0

Alright, so I found an answer after changing my keywords.

See also: How to prevent sudo users from running specific commands?

Step 1:

sudo visudo

The syntax is like this:

user host=command

This grants sudo access to a given command. You can also do groups like

%group host=command

You can use ALL in any of the 3 'columns' to apply this to any host, any command, or any user.

My solution was

observing_user ALL=kill -USR1 *

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .