[LBo] 4.1.6 SUID
Dave Lerner
7dvbyfk02 at sneakemail.com
Sun Nov 19 00:44:08 CET 2006
I did a simple test to see if the SUID flag would work.
I created a script /tmp/x with owner root, group root, permissions 755
and then turned on the SUID flag with the command "chmod u+s /tmp/x":
# ls -lF x
-rwsr-xr-x 1 root root 48 2006-11-18 17:45 x*
The contents of /tmp/x are:
#!/bin/sh
touch /tmp/z
echo ${UID}
echo ${EUID}
If I run the script from my normal non-root user, the output is:
$ ./x
1000
1000
And the file /tmp/z is created with my normal user as the owner, not root.
Why isn't the UID output as 0 (root's UID), and why isn't the file
/tmp/z owned by root?
More information about the QnA
mailing list