[TriLUG] SUID question

Richard O. Hammer ROHammer at EarthLink.net
Thu Sep 12 16:34:24 EDT 2002


I seem to be missing something basic about the way SUID
works.  I can't give my ordinary users the powers of root in
executable files.

In the session which I copy below, you can see that I have two
shell scripts, named aOne and aTwo, in a directory named
/permissions.  aOne can only be run by root.  aTwo calls aOne.

It seems to me that my ordinary user (named roh) should be
able to execute aTwo and thus aOne, which is called from aTwo,
because the SUID bit is set on aTwo (and the SGID bit is set
too, in case that might help).  But, as you can see, roh is
denied permission to execute aOne from aTwo.

I am running RedHat 7.3

What am I overlooking?

Thanks,
Rich Hammer


[root at r permissions]# pwd
/permissions
[root at r permissions]# ls -l
total 8
-rwxr--r--    1 root     root           30 Sep 12 16:05 aOne
-rwsr-sr-x    1 root     root           46 Sep 12 16:05 aTwo
[root at r permissions]# cat aOne
#!/bin/bash
echo cracked aOne
[root at r permissions]# cat aTwo
#!/bin/bash
echo in a Two, trying aOne
./aOne
[root at r permissions]# ./aTwo
in a Two, trying aOne
cracked aOne
[root at r permissions]# su roh
[roh at r permissions]$ ./aTwo
/bin/bash: /root/.bashrc: Permission denied
in a Two, trying aOne
./aTwo: ./aOne: /bin/bash: bad interpreter: Permission denied
[roh at r permissions]$



More information about the TriLUG mailing list