Help - Search - Members - Calendar
Full Version: Killing Another Users Process
Linuxhelp > Support > Technical Support

I am using Redhat 8.0 (Kernel 2.4.18-27.8.0). I am trying set up two user accounts that are able to kill each others processes. I have tried creating a cmmon group that both users are members of, I have made the common group the primary group for both users, I have tried to add both users to the sys and adm groups, I tried changing file permissions of the executable that I want to kill to -rwxrwxr-x and -rwxrwxrwx, but every time I try the kill the process by the user that does not own the process I get the following:

[jbrown@jbrown-zaj bin]$ kill -9 9933
bash: kill: (9933) - Operation not permitted

All the documentation, FAQs and references I could find all say that only root can kill another users processes. Is there a way to set up two users that can kill each others processes?

As far as i know, there really isn't any way that you can allow user x to kill user y's processes. The only method available is through using root, which doesn't sound like an appropriate path for you. I've double-checked this with the almighty google, and it seems to agree with me.

An alternative might be to check out the "sudo" command which can give a user limitied access to a limited set of commands as super user. You can set this up to allow both users access to the kill command using sude, however, they will be able to kill any process currently running on the system, which is still a security risk.
Thanks ... I managed to set it up with sudo

I added the following entries to "/etc/sudoers" :
testuser2 ALL = (testuser1) NOPASSWD: /usr/bin/kill
testuser2 ALL = (testuser1) NOPASSWD: /bin/kill
testuser1 ALL = (testuser2) NOPASSWD: /usr/bin/kill
testuser1 ALL = (testuser2) NOPASSWD: /bin/kill

This allows testuser1 to kill testuser2 processes using the following command:
sudo -u testuser2 kill -9 <pid>

Similarly testuser2 can kill testuser1 processes with:
sudo -u testuser1 kill -9 <pid>

The reason I have entries for both /usr/bin/kill and /bin/kill is because when I open a terminal in Gnome it uses the kill in "/usr/bin", whereas if I "su -" to the user it uses the one in "/bin" ?????

I have never used sudo before, but it is very usefull, and definately worth getting to know better.
Yes, sudo is a great command once you get to know it and respect it.

As for the kill command, I used to have a similar problem in debian before. Whenever i su as root, i couldn't run commands in /bin or /sbin (such as ifconfig for example), but when I ran it with "su -" i was able to have access to the commands. Oh well, everything works fine now tho.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.