Results 1 to 8 of 8
  1. #1
    MAC OS, Admin Privileges

    Member Since
    Dec 01, 2009
    Posts
    4
    MAC OS, Admin Privileges
    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!

  2. #2
    MAC OS, Admin Privileges
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    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.

  3. #3
    MAC OS, Admin Privileges
    Raz0rEdge's Avatar
    Member Since
    Jul 17, 2009
    Location
    MA
    Posts
    8,184
    Specs:
    27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3
    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

  4. #4
    MAC OS, Admin Privileges

    Member Since
    Mar 30, 2004
    Location
    USA
    Posts
    4,744
    Specs:
    12" Apple PowerBook G4 (1.5GHz)
    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

  5. #5
    MAC OS, Admin Privileges

    Member Since
    Dec 01, 2009
    Posts
    4
    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

  6. #6
    MAC OS, Admin Privileges
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    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.

  7. #7
    MAC OS, Admin Privileges

    Member Since
    Dec 01, 2009
    Posts
    4
    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.

  8. #8
    MAC OS, Admin Privileges
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Invisible Items Visible and Admin Privileges Problem
    By PixelMage in forum OS X - Operating System
    Replies: 1
    Last Post: 03-15-2013, 02:09 PM
  2. "This installer requires admin privileges to run."
    By designerskyline in forum OS X - Operating System
    Replies: 7
    Last Post: 05-01-2012, 06:34 PM
  3. Admin Privileges All Messed Up
    By austin.r.herman in forum OS X - Operating System
    Replies: 1
    Last Post: 10-16-2009, 01:42 AM
  4. Admin Privileges - how change?
    By Sawday in forum Switcher Hangout
    Replies: 6
    Last Post: 09-05-2008, 09:13 PM
  5. Replies: 14
    Last Post: 06-16-2005, 06:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •