Solved

URGENT - Making SUID program to restart sendmail

Posted on 1997-08-08
6
190 Views
Last Modified: 2012-05-04
Hi there....

I am trying to make a program that can restart sendmail but I need it accessible from any user.
So any user can restart sendmail.

I have a script that is this:

sh -c 'set `cat /var/run/sendmail.pid`; kill $1; shift; eval "$@"'

But it only works if invoked from user root.
How do I make it suid so anyone can run it?

Thank you so mucj

0
Comment
Question by:pamsam
6 Comments
 
LVL 5

Expert Comment

by:n0thing
ID: 2006634
Hi,

   To make it SUID ... just do a "chmod 4755" on it. However SUID
shell scripts is a security hole, in your case it could be exploited and users might gain root access. You oculd re-code
it either in C, perl or perhaps using sudoers.

Best regards,
Minh Lai
0
 

Author Comment

by:pamsam
ID: 2006635
It didn't work..
I know why though, I need to change the real user ID not just the effective user id.

I can do this in perl by changing the $< variable but for some reason I can only have one exec statement in my script.


0
 
LVL 4

Accepted Solution

by:
jlms earned 200 total points
ID: 2006636
Recent UNIXes don't allow SUID of shell scripts, you need the sudo program or to make a C program that does what you need.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:hotlava
ID: 2006637
Get hold of a program called "sudo" or "super".  not only will
this solve your above problem, it will give you fine grained control over root privileges.

Gary
0
 

Author Comment

by:pamsam
ID: 2006638
Hi.

I worked it out myslef but thanks for trying....


0
 

Author Comment

by:pamsam
ID: 2006639
Hi.

I worked it out myslef but thanks for trying....


0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now