Obtaining Administrator privileges with NSTask

When using NSTask is there a way to make the admin authentication prompt appear the way "with administrator privileges" does in applescript

The link you provided doesn't work but nothing a quick google couldn't solve... so for the sake of testing how things work I tried the code below but it just prompts me for a password it never carries anything out... what am I doing wrong
- (IBAction)testMe:(id)sender;
AuthorizationRef authorizationRef;
OSStatus status;
status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
kAuthorizationFlagDefaults, &authorizationRef);
char *tool= "/usr/bin/mkdir";
char *args[] = {"/test",NULL};
FILE *pipe = NULL;
status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, args, &pipe);
@end

Similar Messages

  • How do I obtain administrative privileges in order to install software ?

    How do I obtain administrative privileges in order to download software ?  I am  trying to download Garmin Maps for my Garmin Nuvi 260W.  Thank you.

    Thanks Eric.  I am the user administrator plus there is a guest user.  However, when I attempt to download Garmin Express installer an apple box appears requesting my Apple Id and password and when I enter this nothing happens and when I cancel this I get a message stating that I need administrative privileges to install the software .  Any assistance which you could give me would be greatly appreciated as it is very frustrating when I am unable to download maps from Garmin when I have previously purchased lifetime maps.

  • My user was changed to standard how may I obtain administrator privilege again

    My user was changed to standard how may I obtain administrator privilege again

    My user was changed to standard how may I obtain administrator privilege again

  • Access Denied when trying to access shared folders on the server with administrative privileges

    I have problem accessing shared folder on the server machine from Windows 7 machine even if I try to access it with administrative privileges (server Administrator account). I will try now to explain better my situation.
    In my company, we have small network infrastructure with one main server machine (HP ProLiant server) with Windows Server 2012 R2 installed and couple of desktop machines. The network is administrated by me.
    On Windows Server we have installed and setup DHCP, DNS, Remote Access and Routing, File and Storage and Active Directory services. Desktop machines are having Windows 8.1 Pro, Windows 8.1 or Windows 7 Home Premium installed on them. In Active
    Directory I have created domain, User groups and Users for employees in my company and so far, I didn't added desktop machines to the domain.
    Also, I've created one folder on the server which should contain different projects data for network users and I have set access permissions and security for this folder and shared it on the network (I've added couple of users to one user group and I
    gave Full control to this group over this folder). When I try to access this folder from network, I've been asked for login credentials (normally), where I just type in one of users username and password who has been given access permissions to (who is member
    of group with full control over the folder). From Windows 8.1 Pro and Windows 8.1 machines I can access and work on this folder without any problems.
    The problem comes with Windows 7 machines. On Windows 7 machines (I have also tried this with Windows 7 Ultimate in VMWare) I can access server, I can see its shares, but as soon I try to access folder I've created for projects, I get Access Denied message
    with request for User login credentials. Whichever user account I use (even servers main Administrator account) I keep getting this message over and over and I'm unable to access it at all.
    I have also tried to access the server through VPN (from local or outside) but I'm getting the same error again. Also I've tried to add these Windows 7 machines to the domain and login with domain user but the result is the same. Turned off both firewalls
    (on server and desktop machines, which I know is unnecessary, but lets try it), still same case. I've tried couple more things with registry editor on desktop machines which I found on different forums and websites but still no luck. And now I don't know
    what else I can do.
    Does anyone knows what's the problem here, have I set something wrong, have not set something I should?

    Hi MeipoXu,
    thanks for your response. I will first answer on your question.
    Yes, the main issue is that we can see the folder when we access the server but we cannot access its contents from Windows 7 machines. I have tried on two machines, one with Windows 7 Home Premium version and the other one with Windows 7 Ultimate version
    and the situation is the same.
    As you recommended, I've checked Network Discovery and File and Printer Sharing and the situation is next: File and Printer Sharing is turned on all layers (Private, Public and Domain) while Network Discovery is off for all layers too. I don't know if this
    is normal thing but Network Discovery cannot be turned on in Windows Server (I'm able to select Turn on Network Discovery and apply the changes, but when I get back to this settings page, I again see that it's turned off, so I assume this can't be changed
    at all).
    I also tried with icacls in command prompt and everything seems to be ok there regarding permissions. Share permissions are set to Full control to Everyone and Security permissions are set to Full control only for Administrators and the user group I've created
    for employees in my company. The confirmation for this is that on Windows 8 machines you can access this folder without any problem and without getting any message connected with access permissions with any user account within this user group. This share is
    created through File and Storage Services service in Server Manager panel.
    And then something came up on my mind. I went in Server Manager to check shared folder settings in File and Storage Services and under Settings page I saw that "Encrypt data access" has been enabled (I enabled this option because I thought
    I will get more security with this option). I asked my self what would happen if I disable it, tried it and now everything works ok on Windows 7 machines too. Now I assume that Windows 7 doesn't have this feature implemented or there are some
    settings which needs to be set on Windows 7 machines to make this encryption thing work with Windows Server. So basically, I will let this feature off for now until I find out more about it and how to implement it to work with all operating systems.
    I want to thank you once more for your kind help!

  • Unable to install update version 1.6.0.393 with error code 3 (Administrator privileges)

    I am unable to update Creative Cloud to version 1.6.0.393. I am running Windows 7 Professional SP1 and have tried installing in administrator profile.
    The message returned when attempting to start the update is:
    Administrator privileges are required to continue with the installation.(Error code: 3)

    Didn't work for me....I have this same problem.
    Tried all this stuff too:
    "Installing Update" Error, Administrator Privileges are required to continue with the installation (Error Code 3)
    I'm on a network as an admin, have tried opening it as an admin, set "always open as admin"....everything.
    MAD

  • My 'run with administrative privileges' script no longer works - help

    Hey all. I have an applescript that shuts down the computer that I made a while back. I pulled it out today to use it and it no longer works. Here's part of the code I'm having trouble with:
    do shell script ¬
    "sudo shutdown -h now" password "myadminpassword" with administrator privileges
    On old machines this worked great, I would just put the admin password where myadminpassword is and it would work perfectly. Now though, I run it on my machine and I get the prompt to enter my admin username and password before it will shutdown.
    Now this is going on a remote install so I need it to work. Any ideas? The machine is running snow leopard, but it seems to still work on an old leopard macbook pro.

    Well, for one, do not use sudo in do shell script.
    The whole 'with administrator privileges' part takes care of elevating your privileges. sudo has no place in do shell script.
    Don't know if that's your issue, but it's the first thing I'd fix.
    If that doesn't help, are you running the script as your admin user?
    Nowhere in your script are you defining the username to run the command as, therefore it will attempt to run as the current user who may not be the same as your admin user, nor have the same password. You might need to include the username:
    do shell script "shutdown -h now" user name "admin" password "myadminpassword" with administrator privileges

  • How can IT departments set up basic users to run Captivate with Administrator privileges?

    As we all know, on WinVista and Win7 or later systems Adobe Captivate must be launched with Run As Administrator privileges in order to function correctly and not crash.  But the problem here is that in many corporate environments general users are not allowed to have Administrator access to their own work PCs.  This presents something of a dilemma for IT departments with Adobe Captivate users.
    Some time ago on this forum one of the Adobe technical staff chimed in on a thread about the Run As Administrator command and explained the technical steps required to set up a Group Policy in WinVista/Win7 that would allow a basic user to always launch Captivate with the necessary admin privileges even though they did NOT have Administrator access to any other app on their PC. 
    I have searched in vain to find that particular thread and post, so I've started this thread in the hope that someone at Adobe can again chime in to detail the necessary steps again.
    So is there anyone there that can help out?

    DOH! my bad.....I/we run WinXP at present and no UAC.
    However, all may not be lost, try some of these options as posted on teh MS Technet forums....An admin person may need t do this first to enable this for that user...
    Apologies for misundeerstand situation. ;-( hate it when that happens!
    Try these two options:
    Using Compatibility Mode
    NOTE: This will allow you to always have the program run as an administrator when you open it.
    1. Right click on the program shortcut or program .exe file, then click on Properties, and on the Compatibility tab. (See screenshots below)
    NOTE: If you are doing this while logged on as a standard user instead of an administrator, then you will need to also click on the Change settings for all users button and type in the administrator's password.
    http://www.sevenforums.com/attachments/tutorials/12832d1243933304-run-administrator-compat ibility_mode1.jpghttp://www.sevenforums.com/attachments/tutorials/12832d1243933304-run-administrator-compat ibility_mode1.jpghttp://www.sevenforums.com/attachments/tutorials/12832d1243933304-run-administrator-compat ibility_mode1.jpgUAC, then click on Yes to apply permission to allow the program to run with full permission as an administrator.
    2. To Always Run this Program as an Administrator
    A) Check the Run this program as an administrator box, and click on OK. (See screenshots above)
    3. To Not Always Run this Program as an Administrator
    A) Uncheck the Run this program as an administrator box, and click on OK. (See screenshots below step 1)
    4. Open the program.
    5. If prompted by
    NOTE: If you are doing this is while logged in as standard user instead of an administrator, then you will need to provide the administrator's password before the program will run as administrator.
    Using Advanced Properties
    NOTE: This will allow you to always have the program run as an administrator when you open it.
    1. Right click on the shortcut of the program, then click on Properties.
    2. Click on the Shortcut tab for a program shortcut, then cllick on the Advanced button. (See screenshot below)
    http://www.sevenforums.com/attachments/tutorials/12834d1243933304-run-administrator-advanc ed_properties1a.jpghttp://www.sevenforums.com/attachments/tutorials/12834d1243933304-run-administrator-advanc ed_properties1a.jpghttp://www.sevenforums.com/attachments/tutorials/12834d1243933304-run-administrator-advanc ed_properties1a.jpghttp://www.sevenforums.com/attachments/tutorials/12836d1243933304-run-administrator-advanc ed_properties2.jpghttp://www.sevenforums.com/attachments/tutorials/12836d1243933304-run-administrator-advanc ed_properties2.jpghttp://www.sevenforums.com/attachments/tutorials/12836d1243933304-run-administrator-advanc ed_properties2.jpgUAC, then click on Yes to apply permission to allow the program to run with full permission as an Administrator.
    3. To Always Run this Program as an Administrator
    A) Check the Run as administrator box, and click on OK. (See screenshot below)
    4. To Not Always Run this Program as an Administrator
    A) Uncheck the Run as administrator box, and click on OK. (See screenshot above)
    5. Click on OK. (See screenshot below step 2)
    6. Open the program.
    7. If prompted by
    NOTE: If you are doing this is while logged in as standard user instead of an administrator, then you will need to provide the administrator's password before the program will run as administrator

  • I have windows vista user account with administrator privilege. I am unable to update mozilla firefox to the latest version. It is saying "do not have required privileges". I already uninstalled the previous version :(

    I am unable to update mozilla firefox. I have user account with administrator privilege.

    Try to run the installer as Administrator via the right-click context menu (Run as Administrator).

  • Error inserting image file in Excel 2013, it's working with administrator privileges

    When I tri to insert image file like .JPG in Excel 2013, I get an import error. It's working fine with administrator privileges.
    I check, graphic filter (registry values)  and made also an Office repare. But i have still the problem.
    My computer: Windows 8.1 64 bits, Office 2013 32 bits

    Try to check the grant permission for the Excel property itself.
    Try to insert image from other path, e.g. D:\ to check if we still receive the error.
    Try to run Excel with safe mode. ("Excel.exe /safe") and perform th insert action without any add-ins interrupt. Thanks.
    Tony Chen
    TechNet Community Support

  • •Install Photoshop Elements with an account that has administrative privileges

    I will be upgrading to photoshop elements 12 and read that it was necessary to install photoshop elements with an account that has administrative privileges.  I'm not sure how to do this. 

    Waltard wrote:
    I guess I’m wondering if I upgrade to photoshop elements 12 whether the problem will continue with 12
    There is no problem with any of the PSE versions.  I have used version 10, version 11 and version 12 in trial mode and I didn't see any problems with any of them.
    Your case is unique in that you have only one user account on the machine and so by default that account has all the privileges of an Administrator.
    also, you don't need to uninstall anything;  Version 10 and version 12 can work from your one machine.  they are installed on separate folders so don't worry about having old version on your machine.
    Just go ahead and install version 12.  You can download a trial version of PSE12 and it has all the features and functions of the boxed version that you can buy from Amazon or some big name stores.  After installing the trial version, you can use it for 30 days and by that time you will have made up your mind whether 12 is better for your need.  If you like it, all you need to do is to buy the boxed version and use the serial number to activate what is already on your machine.  You don't need to re-install it using the DVDs in the box.
    Hope this helps.

  • Blackberry Media Sync Failed To Initialize - Run With Administrative Privileges

    I've downloaded the Blackberry Desktop Manager (4.7) and everything works fine except for the Blackberry Media Sync which fails to initialize and needs to be run with administrative privileges.  Anyone experience this and how did you correct the administrative privileges situation.  I am using a BB Bold.  TYIA

    BlackBerry Media Sync has just been updated to version 2.0.
    I suggest you download it and see if the issue is solved.
    The search box on top-right of this page is your true friend, and the public Knowledge Base too:

  • Open application with administrative privilege

    Can anyone point me to resources on how to execute a command in Java to open an application with administrative privileges - similar to the windows runas command - but will accept the login and password in the command?

    First figure out how to do it at the command line (it's beyond me). Then use Runtime.exec() to run the command. You'll have to use the Process's output stream to respond to the password prompt, and it's possible that might not work if Windows isn't prompting on stdin.

  • CS5 Updates only with Administrator Privileges?

    Hi!
    I installed CS5 Design Premium on several PCs in the company as administrator, the Users dont have administrator-privileges. The problem is, that CS5 does prompt for updates very often at the moment, and the users cant apply them. Is there a way to let them apply the updates without administrator privileges? I dont want to update this much PCs on my own and i dont want to give the users admin privs, of course
    Cheers & thanks for help,
    Chris

    We made a "hack" to get this possibillity under CS4.
    You have to look into "runaspc.exe" in order to get it to work.
    That's the way we did it.
    Not an ideal solution but Adobe has not yet managed to their updates to work with eg WSUS or similar.
    They have however released their Adobe Update Server, but that doesn't help one bit as the update procedure still needs administrative rights.

  • Creative Cloud opening stops half way through with message: administrative privilege required.

    creative cloud opening stops half way through with message: administrative privilege required.

    It means what it says - you have to run as admin or a similar user with sufficient user privileges.
    Mylenium

  • Do Shell Script .. with Administrator Privileges ... ?

    hi everyone!
    I have a script that have multiple lines like this:
    do shell script " ... " with administrator privileges
    do shell script " ... " with administrator privileges
    Mac OS X 10.4 does it right(?) by asking ONCE for an admin login/password, and would run both lines above ... but 10.2 (and 10.3?) asks TWICE for the password using the same code. What am I doing wrong? I want all versions 10.2-4 to ask only once ... Any ideas?
    Thank you!!
    Cass

    If you would prefer that your script would not ask for a password to get admin privileges, then this uses the keychain:
    set aVariable to do shell script DefinedAsVariable password getPassw() with administrator privileges
    -- The Handler --
    The following handler assumes you have a password in your keychain called ASPW (could be anything you want) saved as a generic key. To do that, open your Keychain Access (in Utilities) application, choose file New, and in the sheet give it a name, enter your account name and type the password you want to use (your admin password in this case). OK. Now find the new password and double-click it. Under the attributes tab change Kind to generic key (it will be Applications). This makes for a fast search because there aren't many of them. Switch to the access control tab and select the "Allow all applications to access this item" button. Enter your admin password in the dialog that appears, and you are done. The first time you run the script, you'll have to click "Always Allow" in the dialog that appears - perhaps several times. After that, it won't ask.
    to getPassw()
    tell application "Keychain Scripting"
    launch
    tell current keychain to ¬
    tell (some generic key whose name is "ASPW")
    return password
    end tell
    end tell
    end getPassw

Maybe you are looking for

  • 12 hours restoring and going...

    Hi I bought a new iPhone 5s and it's taking forever to restore from iTunes. Now it's been 12 hours and the iPhone screen still says "restore in progress" and the iTunes message "restoring" although it does not give the time left to complete it. What

  • Posting wagetypes to fico with tax

    Hi experts, i have the requirement, to split the non-cash benefit for a company car, and post tax and net-value separately. Since the usual wagetype customizing, using symbolic accounts (tables T52EK - T52EL - T030 ) does not support tax-codes, i tho

  • How to use protect and protect

    how to use protect and endprotect for two different element. iam using one element for 'tax' and one for 'item total' i wnt to print two elements in one page only.

  • Random dates missing from phone after isync

    Hi, I have recently found that some of the dates I add to my iCal do not sync to my phone (K800i). It seems to be a random pattern and I cannot see any difference between the dates that appear and the ones that don't. Has anybody else had this, or kn

  • How to select matching RGB and CMYK colors

    Starting from scratch for a client, how do I select matching RGB and CMYK pairs? Say we find a nice red colour in RGB for screen use, how do I then find the correct CMYK for print? And what assumptions do I have to make when doing this, if any? Would