• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to Run a "sudo" Terminal Command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to Run a "sudo" Terminal Command


  • Subject: Re: How to Run a "sudo" Terminal Command
  • From: Jim Weisbin <email@hidden>
  • Date: Thu, 17 Dec 2015 11:11:31 -0500


"S. J. Cunningham" <email@hidden> wrote:

I'd like to know how to do it _without_ the dialog.  Something like:

do shell script xxx with user ID yyy and password zzz


There is a way, but whether or not it is an acceptable security risk to you is a question I can’t answer.

You can find info here:

http://hints.macworld.com/article.php?story=20021202054815892

Basically you can edit /etc/sudoers so your admin user is a sudoer with all privileges. Then your shell script can use “sudo” without getting a prompt back.

This of course means that the script is not portable, but neither would it be if you were to hard encode a username and password into it.

Jim Weisbin | C.T.O. | human | 138 Fifth Avenue | 3rd Floor | New York, NY | 10011 |  (212) 352-0211 |  (917) 375-2272 | Los Angeles Office | 2046 Broadway | Santa Monica, CA | 90404 |  (310) 264-0211 telephone | www.humanworldwide.com

Click here to view our online reel


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: How to Run a "sudo" Terminal Command
  • Next by Date: Re: AS Library Question
  • Previous by thread: Re: How to Run a "sudo" Terminal Command
  • Next by thread: [ANN] CalendarLib, improved Calendar scripting
  • Index(es):
    • Date
    • Thread