How to make setuid / suid shell scripts work the way setuid binaries work?
Issue
-
What's the procedure to get root-owned setuid scripts to always be run with root permissions?
-
When executing shell scripts that have the setuid bit (e.g., perms of
rwsr-xr-x
), the scripts run as the user that executes them, not as the user that owns them. This is contrary to how setuid is handled for binaries (e.g.,/usr/bin/passwd
), which run as the user that owns them, regardless of which user executes them.
Environment
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 4
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.