• 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: Gnarlodious <email@hidden>
  • Date: Mon, 17 May 2004 17:54:36 -0600

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
> ----
>
> - Ken

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.

--
Change your sidebar's "Computer" icon:
http://www.Gnarlodious.com/Mac/AppleScript/Finder-ChangeComputerIcon.sit
_______________________________________________
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.


  • Follow-Ups:
    • Re: adding authentication...
      • From: Graff <email@hidden>
References: 
 >Re: adding authentication... (From: Graff <email@hidden>)

  • Prev by Date: Q: echo | sed ; can't replace range of lines
  • Next by Date: Re: Q: echo | sed ; can't replace range of lines
  • Previous by thread: Re: adding authentication...
  • Next by thread: Re: adding authentication...
  • Index(es):
    • Date
    • Thread