Michael O'Keefe wrote:
> Carl Lowenstein wrote:
>> On Tue, May 27, 2008 at 1:25 PM, <[EMAIL PROTECTED]> wrote:
>>> I created this 2 line script:
>>>
>>> ===============================================
>>> #!/bin/sh
>>> echo `whoami`
>>> ===============================================
>>>
>>> With these perms:
>>>
>>> ===============================================
>>> 4 -rwsr-sr-x 1 seb seb 24 2008-05-27 13:21 test
>>> ===============================================
>>>
>>> Why doesn't it print seb when I run it as root?....
>>>
>>> ===============================================
>>> # ./test
>>> root
>>> ===============================================
>>>
>>> Doesn't setting setuid bit imply it must run as if you are user seb?
>>>
>>> How make it do this?
>>
>> Something between all and nearly all Unix-like operating systems do
>> not honor SETUID for scripts. For security reasons.
>
> I think it's actually that the interpreter itself is not setuid.
> I think if you set /bin/sh to be setuid, it might work.
> Or you might have to run the setuid enabled /bin/sh to execute the
> script rather than relying on the kernel to call out the interpreter itself
>
Nope, any hashbanger, I think.
Try this
- - -
cat >whoami.pl <<EOF
#!/usr/bin/perl -w
print "real:<=$< (=$( eff: >=$> )=$)\n";
print "ENV{user}=$ENV{USER}\n";
EOF
chmod +x,u+s,g+s whoami.pl
sudo ./whoami.pl
- - -
Regards,
..jim
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list