• 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: adding authentication...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding authentication...


  • Subject: Re: adding authentication...
  • From: Martha Espinosa <email@hidden>
  • Date: Tue, 18 May 2004 07:46:52 -0600

Thank you all for your responses. I created a password window; used the sudo -k and set passwd to "".

I was almost on the right track..

Again, thanks!


At 9:50 PM -0400 5/17/04, Graff wrote:
On May 17, 2004, at 7:54 PM, Gnarlodious wrote:

Entity Graff spoke thus:

What you need to do is to bring up a dialog window which asks for the
password, then pass that password to the command. Here's how I would
do it in a regular ScriptEditor-created application:
----
display dialog "Enter in your password" default answer "" buttons
{"Cancel", "Erase Files"} default button "Erase Files"
set theReply to result
if button returned of theReply is "Erase Files" then
set thePassword to text returned of theReply
do shell script "sudo rm -r /somepath/somefile" password thePassword
with administrator privileges
end if
----

But keep in mind 2 things for security.

At the end of your script you should say:

set thePassword to "" -- erase password
do shell script "sudo -k" -- deauthenticate

For a general distribution script, you'll find that people dislike typing
their password into a field where the typing shows. The shell's

authentication dialog "please enter your password" is better. Much more
secure.

Oh, I agree. I'd rather use the authentication dialog that comes with "do shell script...with administrator privileges" for entering the password rather than the simple "display dialog" that AppleScript has. There are a few OSAX out there that give AppleScript a proper password dialog I believe, if someone really wants it.

- Ken
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: adding authentication... (From: Gnarlodious <email@hidden>)
 >Re: adding authentication... (From: Graff <email@hidden>)

  • Prev by Date: Running an FM script with an Applescript
  • Next by Date: Re: problem to display Tibetan
  • Previous by thread: Re: adding authentication...
  • Next by thread: Q: echo | sed ; can't replace range of lines
  • Index(es):
    • Date
    • Thread