14th December 2016

Among many other formats, it can test.dmg's as well. Note that JtR does not 'break' the encryption, it just automates and speeds the process of trying thousands (or millions, or trillions) of dictionary-based and random passwords in hopes of eventually hitting the correct one that decrypts your data. Disk image file (.dmg) from command line 14th December 2016 #cli #dmg #hdiutil #keychain #mac #security. I prefer.dmg instaed of zip for archiving project data, etc.dmg is handy for refering files, modify contents without extract files to somewhere.

First let me say I run Macintosh OS X Tiger 10.4.10. NOT A PC/XP/VISTA! I swear to go if someone gives me a PC answer. Anyways, I have a disk image (.dmg) file that I encryped with Disk Utility and I have forgotten the password. Is there any way to crack/hack it/open it? I have some C, C, Applescript, HTML, and JavaScript experience. I am also the administrator of the computer and have. I am working on bitstream (dd) images of disks from MacBook (Mac OS X 10.11.6) encrypted with File Vault 2. I do not have any password, passphrase or recovery key to unlock the drive, but I am not interested on unlocking/decrypting the drive.

I prefer .dmg instaed of zip for archiving project data, etc. .dmg is handy for refering files, modify contents without extract files to somewhere.

.dmg can usable as like USB drive. Disk Utility tool can create/update .dmg from folder with various options. Options are like encryption, readonly, compression, etc.

But if you have tens of folders to archive, it’s better to use command line tools.

Create encrypted .dmg file

Disk image .dmg does not ask for password when encrypted emails

hdiutil is command line version of Disk Utility app. This command can mount/unmount/create/update disk image files. Please see man hdiutil for more detail.

Disk Image .dmg Does Not Ask For Password When Encrypted Files

Below script is part of my workflow of archiving project files. I’m using encrypted .dmg for archive. The script require prepare password file under $HOME/.dmg-password. Please create and store password for .dmg without LF.

And update permission like chmod 600 $HOME/.dmg-password to prevent read from other users. This sequence using password and encryption. But it’s not strong enough, reason described below.

Preset password for .dmg in Key Chain

It’s kind of pain in neck entering password for opening .dmg everytime. If you open .dmg from Finder.app, the password dialog refuse copy & paste operation.

There is option “remember password in my keychain”. Concept is similar to this.

The password for disk image is stored in keychain which identified by UUID of .dmg. The UUID is referable by command like below.

Now you can store password through security command.

Disk Image .dmg Does Not Ask For Password When Encrypted Emails

Unfortunatelly, there are no option like -stdinpass. So the password must be passed through command line argument. This mean optential leak through ps command or shell history.

By the way, I’m using below script for preset password to disk images.

When opening .dmg from Finder, operating system ask authorisation of using password by diskimages-helper.

Disk Image .dmg Does Not Ask For Password When Encrypted Mean

You can skip this dialog by -A option of security command, but this option authorise for all applications. It’s better not use this -A option for better security.