Skip navigation

Remember password option?

351 Views 3 Replies Latest reply: Feb 2, 2013 7:47 PM by Camelot RSS
MacMan240 Level 1 Level 1 (80 points)
Currently Being Moderated
Feb 2, 2013 3:58 PM

I'm writing a simple applescript program so my computer illiterate girlfriend can start a plex movie server with one click on her computer, to watch on a Roku. I would like to incorperate a way for the program to remember the password for the features that require administrator access to terminal so she doesnt always have to type it.

 

Here is part of the script:

 

set PowerSource to (do shell script "pmset -g ps")

do shell script "sudo ifconfig en1 up" with administrator privileges

if PowerSource does not contain "AC Power" then

          display alert "Please plug your computer in to a power source, then click continue."

else

MacBook Pro, OS X Mountain Lion (10.8.2), 2.3 GHz i5, 4GB RAM, OCZ 120GB SSD
  • xnav Level 5 Level 5 (6,615 points)
    Currently Being Moderated
    Feb 2, 2013 4:44 PM (in response to MacMan240)

    You could put the pw in the script but save it as an application so it's not human readable.  Save the readable source of the script with a bogus pw.

  • Camelot Level 8 Level 8 (45,670 points)
    Currently Being Moderated
    Feb 2, 2013 7:47 PM (in response to MacMan240)

    If it's just your girlfriend, you're probably not overly worried about security, so a simple change to your script should suffice...

     

    set PowerSource to (do shell script "pmset -g ps")

    do shell script "sudo ifconfig en1 up" user name "blah" password "blabblah" with administrator privileges

    if PowerSource does not contain "AC Power" then

              display alert "Please plug your computer in to a power source, then click continue."

    else

      --...

    end if

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.