• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

URGENT - Making SUID program to restart sendmail

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

1 Solution

   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
pamsamAuthor Commented:
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.

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.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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.

pamsamAuthor Commented:

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

pamsamAuthor Commented:

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now