• 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: Mount With Password
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mount With Password


  • Subject: Re: Mount With Password
  • From: Luther Fuller <email@hidden>
  • Date: Mon, 29 Mar 2010 08:13:06 -0500

On Mar 29, 2010, at 2:53 AM, Axel Luttgens wrote:

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

I looked at the printf man page. I didn't really want to see anything that complicated, but I tried this anyway ...

set imageAlias to alias "OS_X:Users:lutherfuller:Desktop:Password TEST:PassWordTest.sparsebundle"
set pw to "abcd"
quoted form of (POSIX path of imageAlias)
do shell script "printf " & pw & " | hdiutil attach -stdinpass " & the result

And it worked!

And yes: where do you take the password from? :-)

The password is a UUID obtained from any mountable and removable device such as a thumb drive. If the device is not mounted, you can't open the encrypted image file. There will be a lot of AppleScripting involved to get it working right, but now it seems feasible. (But, is it useful?)

 _______________________________________________
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

  • Follow-Ups:
    • Re: Mount With Password
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Mount With Password (From: Luther Fuller <email@hidden>)
 >Re: Mount With Password (From: Axel Luttgens <email@hidden>)
 >Re: Mount With Password (From: Luther Fuller <email@hidden>)
 >Re: Mount With Password (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Mount With Password
  • Next by Date: Re: Mount With Password
  • Previous by thread: Re: Mount With Password
  • Next by thread: Re: Mount With Password
  • Index(es):
    • Date
    • Thread