LinuxQuestions.org
Review your favorite Linux distribution.
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 12-01-2008, 11:15 AM   #1
allasso
Member
 
Registered: Oct 2003
Distribution: debian
Posts: 35

Rep: Reputation: 15
need root to setuid bit?


Hello,

Do I need to be root to set the setuid bit on an executable that I am the owner of?

Thanks, Allasso
 
Old 12-01-2008, 11:44 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by allasso View Post
Do I need to be root to set the setuid bit on an executable that I am the owner of?
You're free to experiment. You don't need anyone's permission for that. This question you could easily answer yourself. Please try.
 
Old 12-01-2008, 12:54 PM   #3
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
The SUID bit means you will BECOME the root.
Which potentially means you could gain rights to something you don't need, maybe destroying things.

Only use the root suid for things that you must run as root.
Else I would not recommend using the suid bit
 
Old 12-01-2008, 08:26 PM   #4
allasso
Member
 
Registered: Oct 2003
Distribution: debian
Posts: 35

Original Poster
Rep: Reputation: 15
Thank you, UnSpawn, I appreciate your reply.

The answer is no, I don't have to be root, I can set the suid bit on files that I am the owner of. When I posted, I was having some other issues that made it appear that I couldn't, and I didn't know until now that simply running ls -l will show an "s" in the execute column if it is set. But I see it is getting set, even for shell scripts.

gerben12, the way I understand it, what one "BECOMES" is simply the owner of the executable that is being executed. They would only become root if root is the owner. If Joe is the owner, they become Joe.

The demonstration here http://en.wikipedia.org/wiki/Setuid seems to show that clearly.

Thanks for your replies,

Allasso

Last edited by allasso; 12-01-2008 at 08:31 PM.
 
Old 12-02-2008, 04:03 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by allasso View Post
I see it is getting set, even for shell scripts.
...but you know in Linux the setuid bit won't be effective on shell scripts, right?
 
Old 12-03-2008, 01:51 AM   #6
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
Quote:
the way I understand it, what one "BECOMES" is simply the owner of the executable that is being executed. They would only become root if root is the owner. If Joe is the owner, they become Joe.
I know if Joe is the owner you become Joe, but your original question was:

do I need to be root to set the uid bit.
Wrong assumption maybe

Anyway thank for your reaction too.

Last edited by gerben12; 12-03-2008 at 01:53 AM.
 
  


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
Sorry, sudo must be setuid root kurtdriver Fedora 6 10-22-2008 07:47 PM
How can I have a script owned as root and run as root by a user: setuid? stickey bit? abefroman Linux - Newbie 9 04-19-2008 05:15 PM
How can I use the setuid bit on a file in Debian HGeneAnthony Linux - General 7 10-25-2006 06:38 AM
How to setuid root abridge Linux - Newbie 4 04-06-2005 03:59 PM
smbmnt - setuid root harperonline Linux - General 1 11-16-2003 05:15 AM

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

All times are GMT -5. The time now is 01:19 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