• 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: BJ Terry <email@hidden>
  • Date: Mon, 17 May 2004 13:43:20 -0700

You could use whatever custom dialog you plan on using, and then, with the result:

do shell script "echo " & password & " | sudo -S rm -r /somepath/somefile"

the -S flag for sudo allows it to take a password from stdin. This isn't good security practice, however, as the commands you run from the command line are visible to the world, if I remember correctly (I'm sure there are many here who can correct me on this point). It'd be easiest just to let the system do it's thing, with regard to the dialog box, since that's the reason it exists, so applications can't jack your password. I'm not sure how powerful using cocoa in AppleScript is, but in Objective-C, you can setup an NSTask and use an NSPipe connected to its stdin and just send the password down that. This may be harder than in Obj-C though.

BJ


On May 17, 2004, at 11:32 AM, Martha Espinosa wrote:

I have a cocoa application written in applescript. Mostly using do shell commands. I need to have the user type in their admin password.

I don't want to use the typical window when you use "do shell script "sudo rm -r /somepath/somefile with administrator privileges"

Does anyone have an example to help me achieve this?
_______________________________________________
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: 
 >adding authentication... (From: Martha Espinosa <email@hidden>)

  • Prev by Date: adding authentication...
  • Next by Date: Re: adding authentication...
  • Previous by thread: adding authentication...
  • Next by thread: Re: adding authentication...
  • Index(es):
    • Date
    • Thread