Would enabling the setuid bit on a shell script make a difference at all when that script is run on boot? Who would the effective user be?

  • Are you saying to setuid the script to be owned by root or another normal user? setuid to root on a script does not matter, since all the boot procedures are handled under the root account. It would probably be different for system accounts like most they do is su to a system/functional account with in the root script (after checking the UID to be 0) and then execute the script necessary under the other account privileges. – Nikhil Mulley Dec 8 '11 at 8:53
  • If you just want any other user apart from root and functional system accounts, then I would suggest you do that after the boot process is completed and system is completely initiated at the desired runlevel and accept the logins, preferrably under /etc/rc.d/rc.local script, however still would have to do su to switch user and execute the script. – Nikhil Mulley Dec 8 '11 at 8:55

No, setting the bit would have no effect during boot. During the boot proper, all proccesses run as root. As daemons are spawned, some are run as the appropriate daemon user, but unless your script is called by one of them instead of the init scripts you don't need the suid bit.


Setting the setuid bit on a shell script has no real effect ever (except during specific permissions checks by other programs), as shells are generally not configured to run scripts setuid.


The s permission has no meaning for shell scripts you must use the "setuid" system call in your program to do that but The operating system does not support the setuid or setgid subroutines within a shell script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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