• 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: remember in keychain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remember in keychain


  • Subject: Re: remember in keychain
  • From: deivy petrescu <email@hidden>
  • Date: Tue, 18 Dec 2007 22:27:24 -0500


On Dec 16, 2007, at 11:51, tom evans wrote:

Hi,

I'm a noob to scripting, but what i'm trying to do is automate the maintenance routines.

I have the script:

do shell script "sudo daily" with administrator privileges
display dialog "The daily, maintenance scripts have completed."


(and weekly & monthly), and I trigger them from Ical. They work fine, but I have to put in the admin password every time.


I don't want to hard-code my admin password, is there a way to get a check-box "add to keychain" or "remember in keychain", so the next time I enter the password will be the last?

Thanks,

Tom

Tom,
depending on the reason you do not want to hardcode your password, a good solution is using " property passwd:"" ".
People will not be able to see your password by looking at the script, and if they tamper with the script, they lose the password.
So it seems like a winning option, but not quite.
One can still see the password by opening the script on a text editor program.
To avoid that, save the password as ascii characters. This can not be retrieved.
Here is the code which I use to do the same stuff (there is a freeware app at my site that runs all the maintenance routines and fixes permissions on top of that).
Here is what I use:
-----script ---


property passwd : ""

if passwd is "" then
set resposta to display dialog "Please enter your password" default answer "" buttons {"Update Password", "Cancel"} default button 1 with hidden answer
if button returned of resposta is "Update Password" then
set passwd to {}
repeat with k in text returned of resposta
set end of senha to ASCII number of k
end repeat
else
return
end if
end if


tasks()

on tasks()
	set texto to ""
	repeat with l in passwd
		set texto to texto & (ASCII character l)
	end repeat
	set passwd to texto
...

-----/script ---
_______________________________________________
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
References: 
 >remember in keychain (From: tom evans <email@hidden>)

  • Prev by Date: Re: Re: remember in keychain
  • Next by Date: Re: Bundle Content drawer - what's it good for?
  • Previous by thread: Re: remember in keychain
  • Next by thread: Re: Re: remember in keychain
  • Index(es):
    • Date
    • Thread