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?
Tell me more
×
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.
|
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. |
|||
|
|
suto 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:53suto switch user and execute the script. – Nikhil Mulley Dec 8 '11 at 8:55