how to pass administrator username and password when prompted

Discussion in 'Mac Programming' started by dangtran09, Jun 3, 2016.

  1. dangtran09 macrumors newbie

    Joined:
    Nov 6, 2013
    #1
    Hello All -




    I'm trying to update my wireless SSID pwd using the following commands, however it's prompting for the administrator username and pwd to make changes to the system keychain. I want to make it seamless so the user will not have to enter anything.



    Is there a way to pass the admin's creds and select Allow to make this update change using some kind of commands (applescript, bash, etc)?



    [​IMG]



    Thanks very much.







    Here's my script:



    sudo networksetup -setairportpower en0 off

    sudo networksetup -removepreferredwirelessnetwork en0 Network_Name

    sudo networksetup -setairportpower en0 on

    sudo networksetup -setairportnetwork en0 Network_Name NetworkPWD



    Network_Name = name of my SSID

    NetworkPWD = pwd of the SSID
     
  2. dangtran09 thread starter macrumors newbie

    Joined:
    Nov 6, 2013
    #2
    Another option I can do this is:



    goto keychain access

    find the item

    goto the access control

    change to 'Allow all applications to access this item', then it will not prompt.



    How can i make this changes via command line?
     
  3. dangtran09 thread starter macrumors newbie

    Joined:
    Nov 6, 2013
    #4
    Ok, please disregard the passing of admin creds to the pop-up prompt.

    Now I want to make changes to a key on the keychain access control via command line.

    goto keychain access

    find the key

    goto the access control

    change to 'Allow all applications to access this item'

    how can i do this via command line please?
     
  4. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #5
    In Terminal :

    Code:
    man security
    Good luck.
     

Share This Page