LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2010, 02:52 AM   #1
malickhat
Member
 
Registered: Jun 2009
Posts: 106

Rep: Reputation: 15
Make a Process that can be Kill by all user


Hi,
I've three user in my machine ,and i want to make sure that the process created by the user1 can be killed by other user and vice-versa ,is there any way i can do that without using root password or sudo
 
Old 02-24-2010, 03:23 AM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
A process can only kill another process, when either eUID==SUID or UID==SUID or the process has the capability CAP_KILL. See kill(2).

So in your case you need to be root or use sudo do perform the task. Maybe the libcap from
http://ftp.kernel.org/pub/linux/libs...-privs/libcap2

can help, but giving CAP_KILL to a process, will allow it to kill any process it wants.

Perhaps there is another solution for your problem, if you tell about the reason you want to do this.
 
Old 02-24-2010, 05:24 AM   #3
malickhat
Member
 
Registered: Jun 2009
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by irmin View Post
A process can only kill another process, when either eUID==SUID or UID==SUID or the process has the capability CAP_KILL. See kill(2).

So in your case you need to be root or use sudo do perform the task. Maybe the libcap from
http://ftp.kernel.org/pub/linux/libs...-privs/libcap2

can help, but giving CAP_KILL to a process, will allow it to kill any process it wants.

Perhaps there is another solution for your problem, if you tell about the reason you want to do this.
The Reason I'm asking is that i have a Main script and inside that script it has Two child script(which runs a Daemon).the problem is when user1 runs the main script the daemon runs ,but at this point of time the user2 runs the script and it can't kill the Daemon which it's not owned ,so i need to add some line so that all the user can kill the daemon so that they can run the script and daemon,
And killing the Daemon does not stop any important thing,so i just want to kill the process
 
Old 02-24-2010, 06:06 AM   #4
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Why is it a problem, that each user runs his own daemon process? What if both users want to run the main script at the same time?

If the daemon processes will need access to a certain resource (like a specific network port or a hardware device), then it is better to start the daemons by a dummy user (e.g. nobody) by root and make the daemons to communicate with the main script through a pipe or socket. In this case there will be no need to start and stop the daemon processes.

If the daemon scripts do not access any specific resources, then it is ok to run them concurrently.
 
Old 02-24-2010, 06:40 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,254

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
It does sound odd, but if you really need to do that, you can ensure that the daemon stop/start script has the suid bit set.
This means it will run as the owner, regardless of who runs it eg

rwsr-xr-x daemon daemon daemon_ctrl.sh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash `kill`: process 'B' silently dies; but process 'A' = `kill` spews back debris! GrapefruiTgirl Programming 9 06-23-2009 10:42 AM
Shell Script : Kill a running process when another process starts ashmew2 Linux - General 3 08-20-2008 04:47 AM
kill all the process of the user yusufs Linux - Newbie 2 07-05-2008 05:45 AM
User unable to kill self process ust Linux - Server 1 11-30-2007 09:05 AM
BASH script inform user and kill process mounters Programming 3 02-11-2002 05:57 PM


All times are GMT -5. The time now is 06:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration