New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

MAC OS, Admin Privileges


Post Reply New Thread Subscribe

 
Thread Tools
leongyk

 
Member Since: Dec 01, 2009
Posts: 4
leongyk is an unknown at this point

leongyk is offline
Hi All.

We have a program on MAC, and another seperate app which is an updater.

The updater may need to copy/replace/delete some files in the /System/Library/ folders on the MAC.

But these folders need Admin Privileges to be able to edit the files inside them.

Our program is written in Qt, and i run shell commands, such as "cp" and "rm".

If i am able to run "sudo cp" and "sudo rm" then it should be fine. But the problem is that when i run sudo through the Qt app, it doesn't pop up any dialog to allow the user to type in the password.

Is there any function that can pop up the Standard MAC OS X Authentication Dialog and to give my app admin rights? so that when i call "sudo cp", etc, they wont need the password to be keyed in ?

This updater is also called from the main app.. so "sudo open updater" wont work as well ! same problem !

If theres any other ways around it, i'd be glad to hear as well !

THanks a lot!
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
I don't have an answer, but if you want any respect from the Mac community, you won't use MAC to mean Mac.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,600
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
I think you're doing it the wrong way, using native "cp" and "rm" directly from an application should always be a last resort. You should first attempt to see what facilities the OS provides for doing these things.

I've installed a number of apps that have prompted me for the Admin password in a OS X way to manipulate the system level files, so you might want to dig a bit further into the Mac Cocoa documentation.

Regards
QUOTE Thanks
technologist

 
Member Since: Mar 30, 2004
Location: USA
Posts: 4,744
technologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond repute
Mac Specs: 12" Apple PowerBook G4 (1.5GHz)

technologist is offline
Quote:
Originally Posted by leongyk View Post
The updater may need to copy/replace/delete some files in the /System/Library/ folders on the MAC.
First of all, think very, very carefully about this. If it is at all possible, don't mess with anything in there, since things in /System/Library/ are used by the OS, its services, and possibly other programs. They may be updated in the future by Software Update, and moving or changing them may cause problems when future updates are released.

That said, Apple does have an API for authentication. See:

Mac Dev Center: Authorization Services Programming Guide: Introduction to Authorization Services Programming Guide

Mac Dev Center: Authorization Services C Reference
QUOTE Thanks
leongyk

 
Member Since: Dec 01, 2009
Posts: 4
leongyk is an unknown at this point

leongyk is offline
Thanks razoredge and technologist.

Actually we're writing a cross-platform connection manager, using Qt. And I need to update the System/library files etc to update the hardware drivers of the USB WiMAX devices which connects to the internet (i wont touch any of the other OS stuff). No apple programmers here, so I was put in the project, and i'm completely new to Mac.

Thanks for your suggestions! I will look into them and find the best way
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
leongyk. What do you mean by wtf? You clearly listened to my suggestion in your second post.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
leongyk

 
Member Since: Dec 01, 2009
Posts: 4
leongyk is an unknown at this point

leongyk is offline
xstep, not everyone has been around Mac's as long as you, so you don't have to be cocky about it.

I will still follow it, (i have no idea if it makes a difference or not), but at least the others were helpful and not cocky.
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
I wasn't being cocky. I was being direct.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks

Post Reply New Thread Subscribe


« change dmg icon | Automator -> Small script »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 04:33 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?