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 > Developer Center > Running cocoa .app as root

Running cocoa .app as root
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2004
Status: Offline
Reply With Quote
Jan 11, 2004, 09:45 PM
 
I'm having trouble running a cocoa .app as root. Basicially, what I want to have is a "launcher" application that, when opened, will give the user an option to launch my program as an administrator, or normally. I've looked through Apple's security examples, but I was unable to get the .app to launch. I want to follow Apple's security guidelines, so I don't want to pass the username/password to the terminal or anything. I'd like the program to behave basically like Brian Hill's Pseudo program. I'm assuming I'd need to use LaunchCFMapp, or something along those lines. Any help or ideas will be appreciated.

Nick
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Jan 12, 2004, 11:32 AM
 
Originally posted by Cybergoat:
I'm having trouble running a cocoa .app as root. Basicially, what I want to have is a "launcher" application that, when opened, will give the user an option to launch my program as an administrator, or normally. I've looked through Apple's security examples, but I was unable to get the .app to launch. I want to follow Apple's security guidelines, so I don't want to pass the username/password to the terminal or anything. I'd like the program to behave basically like Brian Hill's Pseudo program. I'm assuming I'd need to use LaunchCFMapp, or something along those lines. Any help or ideas will be appreciated.

Nick
What about using the SetUID bit on the executable?
     
Fresh-Faced Recruit
Join Date: Jan 2004
Status: Offline
Reply With Quote
Jan 12, 2004, 12:05 PM
 
The only problem with using the setUID bit is that when the program is moved after installation, the bit is turned off, and would require extra programming to reset it. As I previously posted, I'd also like to give the user the option to launch the program as root or not, so thus I don't think using the setUID bit is the best path.

Nick
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 15, 2004, 10:23 AM
 
You shouldn't run applications as root. The applications should factor out any privileged code into a helper application.
     
Fresh-Faced Recruit
Join Date: Jan 2004
Status: Offline
Reply With Quote
Jan 15, 2004, 10:05 PM
 
I understand that the application should not be run as root, but for this situation, be it the application itself, or the helper application, I need to be able to run it as root.

Nick
     
Grizzled Veteran
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jan 16, 2004, 03:05 PM
 
Authentication services provides the ability for your program to acquire root permissions.

I haven't used it, so I can't help, but if you've been unable to figure it out, you need to keep trying - that's the right way to do it.

Wade
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 17, 2004, 02:14 PM
 
See ADC Sample Code: Security, specifically AuthSample, AuthForAll and MoreAuthSample. Also see the Security documentation, "Performing Privileged Operations With Authorization Services" is particularly important.
     
   
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 12:50 PM.
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