make all the processes of a given user killable by anyone
Give the other users permission to kill the processes as the low priority user through
sudo -u lowpriouser /bin/kill PID
A user can only signal their own processes, unless they have root privileges. By using sudo -u
a user with the correct set-up in the sudoers
file may assume the identity of the low priority user and kill the process.
For example:
%killers ALL = (lowpriouser) /bin/kill
This would allow all users in the group killers
to run /bin/kill
as lowpriouser
.
See also the sudoers
manual on your system.
On an OpenBSD system, the same can be done through the native doas
utility with a configuration like
permit :killers as lowpriouser cmd /bin/kill
Then
doas -u lowpriouser /bin/kill PID
See the manuals for doas
and doas.conf
.
You shouldn't kill the processes, if they're low priority they'll consume few resources.
To actually make them low priority, either change their priority manually, or use a daemon like autonice
that I wrote for DEC OSF/1 many years ago (c. 1994) that looks for long-running jobs and progressively reduces their priority the longer they run.
EDIT there's a package called and
that offers this functionality for modern Unices.
I think you approach the issue from the wrong angle: If a process is run at low priority settings (CPU, I/O) it shouldn't affect other processes much because it won't be scheduled to run. As for memory usage, if main memory is tight and the process wasn't scheduled to run in a long time (e. g. due to CPU and I/O constraints), its “clean” pages are dropped and its “dirty” pages are committed or swapped out and no longer affect the performance of other processes.
Conclusion: with the right priority setting and sufficient swap space it should be unnecessary to kill low priority jobs to make “room“ for more important tasks; instead the kernel will take care to put the former to sleep in favour of the latter.