LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   I can setuid binaries, but it doesn't work! Help. (https://www.linuxquestions.org/questions/linux-general-1/i-can-setuid-binaries-but-it-doesnt-work-help-306059/)

boing 03-25-2005 04:41 PM

I can setuid binaries, but it doesn't work! Help.
 
Hi..

Ok, I have a C program, 'prog.c' that does system('ls /root');

1. Its compiled(gcc -o prog prog.c), and runs fine, under root.
Root owns this file.
I want anyone else to be able to view /root, so I do:

chmod 4755 prog
ls -l prog

-rwsr-xr-x 1 root root 11221 2005-03-25 21:34 prog

So prog is now setuid...to run under root from any user.


2. But I keep getting permission denied when ran by any user except root.

WHY?? It's really wrecking my head.

Note: I have tried the same idea between two different normal users, just in case there was some protection against setuiding root files. I'm using slackware 10.1, and havn't messed around with kernel settings. I know linux disabled setuid for scripts, bit this file 'prog' is a binary. Please help.

:confused:

ps. I know prog.c is a stupid program, I'm just using it as an example.

Thanks!
boing

amosf 03-25-2005 04:54 PM

What about chmod 6755 prog? That usually works for me... (shouldn't really be any different tho)

boing 03-25-2005 05:58 PM

Yeah I tried that too...
Thanks tho!

boing

btmiller 03-25-2005 09:14 PM

Is the partition you're running it on mounted nosetuid? If that's the case, setuid binaries won't work on it. You can check this in /etc/mtab.

boing 03-26-2005 12:18 PM

Hi...
Nope, i checked that also...That's why I've no idea why this isn't working :(


Does slackware 10.1 somehow block setuit?


All times are GMT -5. The time now is 12:50 PM.