Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the chmod +s file permission.

Status
Not open for further replies.

maheshs

Programmer
Nov 29, 2002
9
0
0
IN
We are a group of developers and we start some background daemon processes.

We have our own logins and we need to write a shell script that would start and stop (kill )these background processes irrespective of the person who started these processes.

We are not able to kill the processes started by the other developer thru our userid's.

The chmod +s command too is not working for the shell script that we have written.

Please advice.

Mahesh.
 
who owns the script? [chown]

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
The shell script needs to be owned by root with permissions 4755. The first line of the script should also look like this in order for it to run setuid (assuming you're using Bourne shell):

#!/bin/sh -p

Dennis
 
Make sure your version of Unix supports setuid on shell scripts. Certain version will ignore setuid if it sees a #! line.
 
Sorry guys I hven'r tried any of your suggestions as I am sick :-(.

vlad:
The script is owned by the person who wrote it.
It has execute pemissions and anyone can fire it.

The processes started by the script now belong to the person who started it and other developers are not able to kill the processes as and when they like.

Thanks.

msankpal.
 
You could always install and setup SUDO and configure it so the developer group has (sudo)root permisions to stop that &quot;and only&quot; that application/script as root?

Good Luck'
Laurie
 
I would suggest you create a new user in the same group as the rest of the developers specifically for running these daemon processes. Then either use sudo or simply su - theuser -c &quot;/path/to/startup/script&quot;, for example. These would be safer than having setuid shell scripts.


Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top