I have a shell script that I want to set uid bit.
I set the owner to root and set uid bit.
I added ‘whoami’in the shell to check if it is working properly
but when I executed the script, whoami returned user’s name, not root.
Then this is wrong, right? I should have gotten root if uid was set correctly, right?
I have a shell script that I want to set uid bit. I set
Share
You can’t use the setuid bit with shell scripts. The shell parses the shebang line to determine the program to execute, then launches that program without caring the slightest about the setuid bit set on the script.
See https://serverfault.com/questions/8449/cannot-set-uid-on-shell-scripts.