Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

URGENT - Making SUID program to restart sendmail

Posted on 1997-08-08
6
Medium Priority
?
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
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 how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

661 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