Encrypted disk image mounting

I'm trying to find a way to make an AppleScript that will mount an encrypted disk image and enter the password for it automatically. I can make it open all right, but I can't figure out how to make it enter the password (the 'with password' command doesn't seem to work, I'm assuming it only works on remote volumes?).
Any help would be appreciated.

Something like this should work:
<pre>
set myResult to display dialog "Enter password:" default answer "" with hidden answer
set thePW to text returned of myResult
set cmd to "echo -n \"" & thePW & "\" | hdiutil attach /path/to/encrypted/disk/image.dmg -stdinpass"
do shell script cmd
</pre>
There are some security concerns with passing a command string to "do shell script" that contains your password. If other users log on to your machine they could see your password if they happened to be watching the process list at just the right time.
Steve

Similar Messages

  • Encrypted Disk Image mounts without Password

    I've created a new encrypted disk image so that I can store sensitive documents and did it carefully, step by step,(per instructions from www.macworld.com/2425) but after I unmounted, then remount, it doesn't ask me for a password. It just mounts as if it were a regular file. Am I suppose to unmount the volume and drag the disk image to the trash? I don't know what else to try.

    The Mac uses and encrypted database of keys called the "Keychain". When you login, it opens the "login" keychain using your login password. That keychain can be used to provide passwords for applications and services, and form data for web sites. In this particular case, the password for your encrypted disk image is being stored in the keychain and automatically provided.
    If another user attempted to open the disk image, the disk image mounter would first look in his keychain and then the system keychain for a key to open it with. Finding none, it would prompt the user to specify the key (password). If the user supplies the correct password, the system would put it in his keychain for safe keeping, and the user would then be able to open the image again without supplying the password.
    You can remove the key from your keychain by opening up /Applications/Utilities/Keychain Access, selecting the "login" keychain, and then looking for an entry with a name that matches the .dmg file in question. Highlight it, and then press the delete key to delete it. The next time you attempt to open it, it will prompt you for a password.

  • Encrypted disk image mount error

    When I try to open one particular encrypted disk image, a Warning dialog box opens with the following message:
    The disk image you are opening may be
    damaged and could damage your system.
    Are you sure you want to open this disk image?
    If I answer yes, the image mounts and I can see at least the one file I tried.
    I don't want to risk ruining the contents of the disk image, so I am not using
    it anymore, and have run Disk Utility/First Aid on it.
    By running this script while Disk Utility "Repairs Disk":
    { while [ 1 ]; do ps axlwww >> psout; sleep 1; done; }
    I can see that Disk Utility runs:
    /sbin/fsck_hfs -y -f -g /dev/disk1s2
    to check a mounted disk image. This works fine on a good encrypted disk image,
    but Disk Utility shows these errors for the broken one:
    A Warning dialog box opens with the following message:
    First Aid failed
    Disk Utility stopped repairing "Safe" because the
    following error was encountered:
    The underlying task reported failure on exit
    and the first aid window shows:
    Verify and Repair disk "Safe"
    Checking HFS Plus volume.
    Checking Extents Overflow file.
    Checking Catalog file.
    Invalid sibling link
    Volume check failed.
    Error: The underlying task reported failure on exit
    1 HFS volume checked
    1 volume could not be repaired because of an error
    Any ideas how to fix this? I tried running
    /sbin/fsck_hfs -y -f -r /dev/disk1s2
    from the terminal, but it complains:
    ** /dev/rdisk1s2
    ** Checking HFS Plus volume.
    ** Checking Extents Overflow file.
    ** Checking Catalog file.
    ** Cannot repair volume when it is mounted with write access.
    ** The volume Safe could not be repaired.
    and running it on the parent .dmg file doesn't work at all.
    Thanks,
    Scott

    Well, I wish you luck, but haven't seen many people fix busted images.

  • Even though I have LCD font smoothing disabled, Mountain Lion still uses it in PDF views, Safari's location bar, Mail's message view, and the dialogs for mounting encrypted disk images.

    Even though I have LCD font smoothing disabled, Mountain Lion still uses it in PDF views, Safari’s location bar, Mail’s message view, and the dialogs for mounting encrypted disk images. Is there any solution to this problem? Also diabled the Smoothing in the SystemPrefs and also via Terminal. Font smoothing is still there. Very annoying, especially in PDF attachments in Apple Mail.

    Try feeding Safari a user-defined CSS file with font-smoothing tweaks (including none). The filename and its filesystem location are arbitrary. Use your favorite coding editor.
    Safari > Preferences > Advanced > Style Sheet:
    Here is an example with all elements uncommented. Pick the one that works best for your Safari viewing and comment out the others:
    Preview. Try Preview > Preferences > PDF > Smooth text and line art (uncheck)

  • Encrypted disk image sometimes mounts without password

    I have an encrypted sparsebundle disk image containing sensitive information.  On occasion (maybe one time out of ten), I'm able to mount it without being prompted for the password.
    The password for the image is not stored in my keychain.  Can anyone offer advice on this issue?

    I was having exactly this same problem!
    I keep a small encrypted disk image storing sensitive banking information. I do NOT have the option to store passwords in Keychain checked, and I verified that the password is not being stored in Keychain.
    Yet, when I double-clicked the supposedly encrypted sparsebundle disk image, it opened right up and mounted - no password required! Unbelievable, right? So I started to investigate.
    I first noticed this behaviour in Mountain Lion, I'm running 10.8.4 on a 2.7 GHz 15" MBPr.
    In past versions of OS X I would mount the volume to work on it by double-clicking on the disk image, enter my passowrd, and then Eject the volume either by dragging to the trash or clicking the Eject button on the Sidebar. The next time I would try to access the disk image by double-clicking it, it would again prompt for a password. All good.
    What seems to be happening in ML is, using the same workflow, even though the volume is disappearing from Finder, the disk image is not actually being unmounted!
    When I go to Disk Utility, the disk image is still mounted, but the volume is grayed out. When I Eject the disk image in Disk Utility, it then reverts to the expected bahaviour, and double-clicking on the disk prompts for a password.
    So the workaround seems to be when finished working on the volume, go to Disk Utility and manually Eject the disk image (as opposed to just the volume it mounts) to ensure it has unmounted and is thus again encrypted. The reason for it sometimes requiring a password, sometimes not is probably because after a restart of the computer it would unmount all disks, and then be unable to re-mount it until the password is entered. But in between, unless you were aware of this behaviour anyone with access to the disk image can view its contents.
    What a terrible security flaw IMO, as there is no visual indication in Finder that the disk image is still unprotected after you unmount its volume and that icon disappears! I'm surprised this hasn't gotten more attention.
    Incidentally brian_c, I tried to look at your linked videos but it returns the message that the videos violated the TOS of the site...?

  • Nested items in docked folder inaccessible on mounted encrypted disk image

    When I click on a folder in the dock, then select a nested folder and try to open it, I get the error message:
    "The application cannot be launched. -35"
    The folders in question reside on an encrypted disk image (which is mounted). If I remove the folder from the dock and then put it in the dock again, this fixes the problem until the disk image is unmounted, and then mounted again.
    Are there any solutions? Thanks.
    iMac G5 10.5.7

    I finally discovered a quick and easy workaround for this problem.
    Using Automator and Cocktail's "built in" Automator actions, I created a script with 2 actions. The first clears the user's dock caches (using Cocktail). The second action is a shell script that relaunches the dock. The script is simply "/usr/bin/killall Dock" (case sensitive, without the quotes).
    I saved the Automator script as an application and dragged the app into my Dock. Now, all I have to do is click on the app in the dock, and click allow in the window that pops up (allowing the app to obtain the password for Cocktail from my keychain) and then the nested items then become immediately available. I don't have to reset any prefs regarding the appearance or behavior of the docked folders. Problem solved!

  • Encrypted disk image on external drive prevents that drive from ejecting

    I've tested this a few different ways, and it seems to be a rather consistent problem.
    I have an external USB hard drive (seagate) and on that drive I use encrypted disk images to store my data.
    (because it's a portable drive, I'm nervous I'll lose it and then someone will have access to my stuff).
    So anyway, whenever I mount the sparse bundle disk image, when it comes time to eject the drive (after ejecting the disk image of course), it hangs for a while and then the Finder says it can't eject, but that I can Force Eject the drive.  When I chose to Force Eject, it works, but I don't like having to force it every time.
    Anyone know what's up?
    Thanks,
    Brian.,

    Open Disk Utility > File > New >Blank Disk Image...
    or use the "Option-⌘-N" Key combo (with Disk Utlity open).
    Kj

  • Create encrypted disk image with OS install disk utility.

    I thought to make a full backup of Macintosh HD, and followed instructions in /kb/ht1553.  However, every time I tried to creae an encrypted disk image, it barfed with "Failed - User interaction required". I assume it needed the encryption password, but for some reason was unable to display a prompt for this. Anyone know how to fix this?  Thanks, Stephen.

    Create an encrypted sparse disk image instead of from folder, mount it, and then drag & drop your files into ii.

  • Creating an Encrypted Disk Image on an External (USB) Drive

    I have an external 600 GB drive (2x 300 GB SATA 3.5" disks in a Thecus N2050 RAID0 external enclosure connected to iMac by USB2) onto which I would like to backup a large amount of data (500 GB).
    I store this external drive away from my home (in the office) and since I cannot guarantee physically locking away the drive I would like to logically lock the drive by placing all the backup data into an encrypted disk image created on that volume.
    I have tried creating an encrypted disk image on my USB volume in Disk Utility (Apple's instructions here) but I experience a number of issues not documented in the Apple article:
    1) I am not presented with a drop-down option for the size of the disk image.
    2) When I go ahead and try to creat the image I am told that the creation was impossible "file or folder does not exist".
    Is it possible to create disk images on USB volumes (I cannot create such a large disk image on my iMac HDD as I do not have sufficient space).
    thanks in advance
    Raf

    I realised that in Disk Utility you must not have any of your mounted drives highlighted in the left hand pane.

  • Indexing of encrypted disk images permanently disabled in 10.8?

    In the past, I've had no trouble forcing Spotlight to index my encrypted disk image, using the command in Terminal:
    sudo mdutil -i on /Volumes/Encrypted_Data
    After entering that command, my encrypted disk image was indexed and searchable using Spotlight.
    A couple weeks ago I updated from Lion to Mountain Lion. Today I noticed Spotlight wasn't showing any results from my encrypted disk image. So went back to Terminal and entered the above command. Instead of successfully activating indexing, Terminal gives me this message:
    /Volumes/Encrypted_Data:
                Indexing disabled.
    Is this procedure now impossible in Mountain Lion?
    Is there any way to enable indexing of this encrypted disk image? I can't get it to work.
    Thanks.

    I appear to have solved the problem to get Spotlight to index a disk image.  My image was an encrypted disk image.  I was able to get spotlight to work when it was new, but now Spotlight won't index it.  Here is the solution that I found:
    After double clicking and mounting disk the image, open Disk Utility, select the disk image file, then click unmount in the Toolbar.  Wait until it is unmounted, then click mount again.   Then go to terminal and try mdutil -sa .  If it is still not enabled, try to sudo mdutil -i on option.  The unmounting and remounting must be done everytime the image is opened.

  • Time Machine Backups of Encrypted Disk Images, Part 2

    Hi:
    If Time Machine is backing up a hard drive that contains a subset encrypted disk image as part of its contents, and this encrypted disk image is mounted (in an unencrypted state) where the enclosed data has been changed/manipulated in any fashion, what and when does Time Machine backup?
    In other words, does the data in the encrypted disk image only change when the encrypted disk image is unmounted? Or is it somehow backed up real time even when the encrypted disk image is mounted on the desktop in an unencrypted state while Time Machine is working?
    Sorry I can't explain this very well, but hopefully the gist is clear.
    Thanks!
    (OS 10.8.2)

    Time Machine doesn't back up a disk image file while it's mounted, whether encrypted or not.

  • Encrypted Disk Image

    Is there any way to have an encrypted disk image warn other users, upon mounting, that it has already been opened or is currently open by someone else? If not, then anything comparable?
    This whole situation arose based upon the need of having a password protected folder on the network. Someone then chose as a solution to have an encrypted disk image.
    Wouldn't several people mounting and writing to such an image simultaneously cause corruption?
    Any workarounds?

    Hi flimps,
    A couple of things...
    1. How did you create the disk image? Did you do it through Disk Utility or a 3rd party program?
    2. Are you checking the box "remember this password in my keychain" when you're creating the password or authenticating? If so, your keychain will automatically store that information and "auto fill" each time you want to access the image.

  • Encrypted Disk Image Won't Partition After Resize

    Hi,
    I have a 10 GB encrypted disk image on my macbook (type OS Extended (journaled)). I've pretty much filled up the space so I want to resize. I go into disk utility with the disk unmounted and 'Resized' it to 20GB. Then I mount it and go into the Partition tab. I drag the corner all the way down to fill up the space and hit Apply. It goes through the motions without error but it does not actually extend the partition to the resize. On the right next it then says something to the effect that the disk is read only and cannot resize the partition. The write status is read/write until I click apple....then it switches to 'Unmounted, read-only'. Any ideas on how to fix this? It's driving me crazy. I can provide screenshots when I'm home from work if necessary.
    Thanks
    Nick

    Here are some screenshots of before and after I try to partition (after the resize):
    After attempting to resize the partition it says 'The disk is not writable and can't be partitioned' and 'The disk is too small to contain partitions'. The disk write status also changed to read only. Doesn't make sense to me...anyone know how to fix this?
    Thanks

  • Encrypted disk image on a network, is the data encrypted during reading/writing?

    I'd like to use an encrypted image for storage of sensitive data on an openly accessible network storage. Does anyone know if the data that is written/read from the image (once it is mounted) is transferred over the network in an encrypted or decrypted form?
    It's seems important, since if the network connection is not encrypted then the data might be accessible to others.

    Efren,
    When you mount an encrypted disk image, the machine you are using (and on which the image is being mounted) is handling all encryption/decryption. So yes, the data that is transmitted across the network is already encrypted.
    Scott

  • Can a 256 bit encrypted disk image be read by Tiger?

    I have computers running Leopard, Tiger and Panther.
    If I create a 256 bit encrypted disk image in Leopard, will the image be able to mount and used for reading and writing in Tiger and or Panther?
    Or should I use 128 bit encryption in a mixed OS X environment?
    TIA,
    Bill

    Hello Bill,
    A 256 bit encrypted disk image created in Leopard can be opened in Panther, and presumably Tiger, though I don't have Tiger.
    It cannot however, be written to, only read.
    So if you want to add to the disk image on Panther, and possibly Tiger, use 128 bit. But if you only want *read only* on the other machines you could use 256 bit.

Maybe you are looking for