• 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 enter the root password into terminal using apple script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to enter the root password into terminal using apple script


  • Subject: Re: How to enter the root password into terminal using apple script
  • From: "W. R. Wing" <email@hidden>
  • Date: Mon, 06 Jun 2005 14:50:38 -0400

At 12:09 PM -0600 6/6/05, Doug McNutt wrote:
At 00:00 +0530 6/6/05, selva.ganesan wrote:
Is there any way to supply password (for sudo) directly from the script?

I have been using a file in my home directory named ppas which is just the text of my password followed by a newline and nothing else. I set the privileges for the file to 600 as recommended for a similar file ".netrc" used by ftp clients.


Now I can:

sudo whatever < $HOME/ppas

which feeds sudo via standard input. If sudo has been executed recently it will not ask for a password and will ignore the standard in.


Alternatively, you can take advantage of sudo's -S switch. So, for example:

echo $pw | sudo -S whatevercommand

which assumes you've previously stored the password in $pw.

			Bill
--
  _
 /~\ The ASCII       | William R. Wing, PhD.  email@hidden 865-574-8839
 \ / Ribbon Campaign | Network Architect, Oak Ridge National Laboratory
  X  Against HTML    | Network Research Group, Computer Sci & Math Div.
 / \ Email!          |_________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How to enter the root password into terminal using apple script (From: "selva.ganesan" <email@hidden>)
 >Re: How to enter the root password into terminal using apple script (From: Doug McNutt <email@hidden>)

  • Prev by Date: Re: Shit - it's all true
  • Next by Date: Re: Shit - it's all true
  • Previous by thread: Re: How to enter the root password into terminal using apple script
  • Next by thread: iphoto
  • Index(es):
    • Date
    • Thread