Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanna run some script with root priviliges but by apache user. So I added SUID bit to script file but this doesn't work as I expected.

Script file owner is root.

rwsr-xr-x  1 root  root  2438 paź  8 12:10

When I run this from bash as root everything works fine... but when I run this as apache user(it's launched by svn hook post-coomit script runing as apache) I'm getting some permission denied messages.

This is strange to me or I misundestood the mining of SUID bit. (users will get file owner’s permissions as well as owner UID and GID when executing a file/program/command.)

So what is the difference. Should I add proper line to /etc/sudoers that will enable runing that script as root...

share|improve this question
up vote 2 down vote accepted

In most enviroments, bash scripts (and most other) cannot be run as SUID (due to severe security issues*).

If you only need a couple of commands run as root, you can edit /etc/sudoers to allow the apache process to run just those specific commands as root.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.