LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-24-2006, 05:49 PM   #1
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
How can I use the setuid bit on a file in Debian


I was trying to use the setuid bit on a file so that it runs as the root user. I then changed the permissions on the file to 700. However, when I try to run the file I get a permission denied error. I was wondering is there a way to set the setuid bit on Debian or has this been taken out?
 
Old 10-24-2006, 06:45 PM   #2
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Quote:
...is there a way to set the setuid bit on Debian or has this been taken out?
Had to chuckle at that.

What is this program trying to do? Is it a script? Scripts may have issues with setuid, that's a fairly high risk security issue, but they can be made to work. If your executable is trying to write to a directory that only root has access to, I think that may cause problems.

Setuid is, surprisingly to me, one of the least documented features in Linux. For some time, I've been thinking about playing around with it to see if I could understand it well enough to write the definitive documentation. Haven't done it yet. Sorry.

Last edited by rickh; 10-24-2006 at 06:48 PM.
 
Old 10-24-2006, 07:08 PM   #3
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
chmod +s file
 
Old 10-24-2006, 07:13 PM   #4
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
I was going on the assumption that he'd already done that.
 
Old 10-24-2006, 07:59 PM   #5
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

Yeah I did that. What I read is that some distros disable the setuid bit from executing on scripts and some distros disable it all together. The script was nothing more that apt-get update;apt-get upgrade. The truth is I can just as easily put all users in the user group and add a rule to let all users in the sudo group run the command with sudo. I'm more curious if this still workes.
 
Old 10-24-2006, 09:15 PM   #6
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Quote:
The script was nothing more that apt-get update;apt-get upgrade.
There is no question that those programs are going to write to directories for which only root has access. I recently needed to have some users write to a file in /etc/network/. I had to give them write access to that directory, as well as set suid on the script. Setuid seems to give permission only the execute the program, but does not carry root priviledges to actions invoked by the program.

As I said, I really want to sit down and study how it works ... one of these days.

Last edited by rickh; 10-24-2006 at 09:16 PM.
 
Old 10-24-2006, 09:17 PM   #7
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
From http://www.tldp.org/HOWTO/Security-H...-security.html
Quote:
SUID Shell Scripts

SUID shell scripts are a serious security risk, and for this reason the kernel will not honor them. Regardless of how secure you think the shell script is, it can be exploited to give the cracker a root shell.
This seems to suggest that it won't work on any distro, since it's a kernel thing...
 
Old 10-25-2006, 06:38 AM   #8
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
Yes, I can confirm it at least on Debian -unstable.

P.S.: Does anyone have a list of Unices that do/don't do this?
P.P.S: It seems this security hole is quite well known.

Last edited by introuble; 10-25-2006 at 12:28 PM.
 
  


Reply



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
No sound on Debian sarge? Need just a little bit of help ... orange400 Linux - Software 6 05-25-2006 06:32 AM
Setuid & file permission Azhrarn Linux - Newbie 1 09-20-2005 09:05 PM
Debian port for PPC 64 bit? microsoft/linux Debian 1 03-18-2005 08:33 PM
Cannot set bit rate in Debian piampri Linux - Networking 7 02-28-2005 02:59 PM
Is Debian a 64 bit OS Asad Debian 3 11-30-2003 11:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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