Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-25-2005, 05:41 PM   #1
LQ Newbie
Registered: Mar 2005
Posts: 5

Rep: Reputation: 0
I can setuid binaries, but it doesn't work! Help.


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 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.

Old 03-25-2005, 05:54 PM   #2
Senior Member
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
What about chmod 6755 prog? That usually works for me... (shouldn't really be any different tho)
Old 03-25-2005, 06:58 PM   #3
LQ Newbie
Registered: Mar 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Yeah I tried that too...
Thanks tho!

Old 03-25-2005, 10:14 PM   #4
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,265

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
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.
Old 03-26-2005, 01:18 PM   #5
LQ Newbie
Registered: Mar 2005
Posts: 5

Original Poster
Rep: Reputation: 0
Nope, i checked that also...That's why I've no idea why this isn't working

Does slackware 10.1 somehow block setuit?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
why setuid didn't work for my script? hueofwind Linux - General 3 11-24-2005 12:07 AM
firefox 1.05 binaries won't work when extracted MidniteHex Linux - Newbie 8 07-19-2005 02:50 AM
Why different binaries do not work across distros? jasmith Linux - Software 1 02-25-2005 07:33 PM
setuid Help devinWhalen Linux - General 2 12-03-2003 10:57 AM
Setuid SirTurbo Linux - General 1 03-26-2003 07:57 PM

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration