Re: Mount With Password
Re: Mount With Password
- Subject: Re: Mount With Password
- From: Axel Luttgens <email@hidden>
- Date: Mon, 29 Mar 2010 09:53:35 +0200
Le 29 mars 2010 à 00:25:57, Luther Fuller a écrit :
> On Mar 28, 2010, at 5:05 PM, Axel Luttgens wrote:
>
>> Apparently because stdin isn't a tty in the context created by "do shell script":
>>
>> do shell script "test -t 0; echo $?"
>> --> 1
>>
>> On the other hand, without the -stdinpass, hdiutil should raise a password dialog with the option to save the password in the user's keychain; in all cases, this would be safer than having a cleartext password stored in a script...
>
> I'm experimenting with using a password that is never seen by human eyeballs. I don't want the user to ever have to type the password, so the password dialog is out. And I don't want the password recorded anywhere, so Keychain is out. (You are wondering where I'm getting the password, aren't you?)
>
> So, I'm looking for a 'do shell script ...' command that will mount a password protected sparsebundle.
Sorry, I misread hdiutil's man page and thus didn't go much further... in fact, hdiutil doesn't require stdin to be a tty for its -stdinpass option to be effective.
The reason here is that, when invoked from "do shell script", the shell is by default in a posix-compatible mode, and the "-n" option isn't recognized by echo. One may for example make use of printf (which is anyway the recommended substitute to echo nowadays):
do shell script "printf 'abcd' | hdiutil attach -stdinpass " & the result
And yes: where do you take the password from? :-)
HTH,
Axel
_______________________________________________
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