Remote mounting of disk images without logged in local user

May 06, '03 08:41:00AM

Contributed by: robg

Reader ssevenup emailed me with a pointer to a thread on the forum site regarding how to mount a disk image from the Terminal (perhaps via SSH while trying to do remote maintenance) when no primary user was logged in on the machine.

The short answer is that, prior to running hdiutil mount some_image.dmg, if nobody is logged in on the machine you must first use disktool -c UID, where UID is a valid user's UID. For example, the first OS X user you created has a UID of 501, root has a UID of 0. So to mount a disk image named "newprogram.dmg" as your normal admin user via SSH when that admin user wasn't logged into the GUI locally, you'd type:

 % disktool -c 501
 % hdiutil mount newprogram.dmg
The disk should mount and be visible in the /Volumes directory. You can read a bit more about this in this archived lists.apple.com email.

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030506054140899