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.
ps. I know prog.c is a stupid program, I'm just using it as an example.