I would like a program that would exist on my flash drive that, when run, would

  • open an encrypted disk image with a stored password
  • then change the password to a random number
  • store it for using it the next time

Can this be done?

link|improve this question

As this is related to your previous question, I edited out the part about what you are asking here. – slhck Jul 29 '11 at 10:26
This will be fun once storing the password fails for some reason. – Daniel Beck Jul 29 '11 at 10:45
feedback

1 Answer

up vote 2 down vote accepted

If you know shell script, you can write s simple program that does that. Use hdiutil to change an encrypted disk password:

hdiutil chpass [image_name]

It will interactively ask you for your previous password and new password so you have to use some pipes or maybe expect. To generate a random number, echo $RANDOM should do. To store the passwords you can use a simple text file, if you don't mind keeping it unprotected.

link|improve this answer
Thanks! What's a tube? – JShoe Jul 29 '11 at 5:56
It's not a tube, it's a pipe. hdiutil expects that you enter your passwords manually. If you want to automate this process you should use expect. Take a look at some Wikipedia examples: en.wikipedia.org/wiki/Expect#Examples – nmat Jul 30 '11 at 3:27
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.