Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

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.