Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

hdiutil, passwords and putty

I'm trying to use putty/plink to login to my mac (from a w7 pc) and use hdiutil to mount an encrypted dmg. I've tried several ways:

plink -ssh user@server hdiutil attach -stdinpass file.dmg

I get prompted for the login password but when I enter it and press return there is no response. No further prompt for the dmg password.

putty -ssh user@server -m textfile

(where text file contains either the hdiutil command above, or names a shell script on the mac containing the command)

In this case I get prompted for the login password and it's accepted, but then the cmd window doesn't accept any further input.

I know that the login password is being accepted because I can echo some text before hdiutil command in the script.


Oddly, it's happy to DETACH a mounted dmg.

plink -ssh user@server hdiutil detach /Volumes/mounteddmg

takes the login password and ejects the volume on the mac. Works every time.


I keep thinking that the problem lies in hdiutil's -stdinpass argument, perhaps it's not seeing the incoming putty/plink connection as stdin?

iMac, OS X Mavericks (10.9.2)

Posted on Feb 25, 2014 6:26 PM

Reply
Question marked as Best reply

Posted on Feb 25, 2014 8:00 PM

plink -ssh user@server 'printf password | hdiutil attach -stdinpass file.dmg'
2 replies

Feb 26, 2014 7:43 AM in response to Linc Davis

That does work! However it does mean that the password is in clear text in a file on the desktop.


I got it to prompt the user for the password:


plink -ssh user@server "echo 'Enter dmg password: '; read -s -n 14 pass; printf $pass | hdiutil attach -stdinpass file.dmg"


I couldn't figure out how to get the shell to take the password terminated with the return key, it always wants ctrl-z so I just had it read the length of the password 😁


Thanks so much!

hdiutil, passwords and putty

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.