Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Confused about setuid...

Confused about setuid...
Thread Tools
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 27, 2005, 11:58 AM
 
The other day I was playing around in the Terminal and I noticed that ping did not show up when I ran a simple ps -U for my username. I then noticed that ping is setuid and was running as root rather than my user. I was surprised to see that quite a few binaries all over my $PATH are setuid root.

I thought I understood the setuid mechanism but I really don't; I guess I'm wondering, what is it about the setuid mechanism that enables me to kill a setuid process that is running as root?
(Last edited by [APi]TheMan; Jan 27, 2005 at 01:58 PM. )
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Fresh-Faced Recruit
Join Date: Dec 2004
Location: Michigan
Status: Offline
Reply With Quote
Jan 27, 2005, 03:56 PM
 
My understanding is that most setuid programs only run as root initially to gain access to some restricted resource, then switch their effective UID to that of the user who started the process. That would allow you to kill it, etc... My guess is that -U does not go by the effective UID.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 27, 2005, 03:58 PM
 
Originally posted by [APi]TheMan:
I thought I understood the setuid mechanism but I really don't; I guess I'm wondering, what is it about the setuid mechanism that enables me to kill a setuid process that is running as root?
The logic for this is actually platform-dependent, and you can see the implementation as used by Darwin here (the ability to read C is required). Basically it's still kinda-sorta owned by you but is effectively running as root, with some extra stuff thrown in there.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jan 28, 2005, 08:50 PM
 
Originally posted by Angus_D:
The logic for this is actually platform-dependent, and you can see the implementation as used by Darwin here (the ability to read C is required). Basically it's still kinda-sorta owned by you but is effectively running as root, with some extra stuff thrown in there.
I don't know enough about the underlying processes to really understand what that code's doing. It sounds like your and Kamsin's explanations will have to do for now, there's obviously some stuff going on under the hood that top doesn't know about.

Thanks.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
   
Thread Tools
Forum Links
Forum 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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:03 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2