goal: script is owned by root and everybody can run it with root permissions. problem: eaven if i do 'chmod 4755 script.sh' script is run with user permissions. script sample: #!/bin/sh ls -l /dir/not/readable/by/user when script is run by root it runs fine, when run as some user it fails. -rwsr-xr-x 1 root root 31 Mar 20 13:05 tt.sh [root@spargate jmikkola]# cat tt.sh #!/bin/sh ls -l /home/skaisanl [root@spargate jmikkola]# [root@spargate jmikkola]# ./tt.sh total 0 [root@spargate jmikkola]# [jmikkola@spargate jmikkola]$ ./tt.sh ls: /home/skaisanl: Permission denied [jmikkola@spargate jmikkola]$ janne mikkola
You cannot run setuid shell scripts, period. It's a security risk.