Source from MacEnterprise
One of the interesting things that can be done with hdiutil is attaching a read-only image using a shadow file. Here’s how:
First, attach the read-only image as with the shadow option:
hdiutil attach -owners on your.dmg -shadow
After typing this command, the image will be attached as a new device to your operating system. Usually this is shown from the command line.
Next, copy over any items, or modify anything on the read-only image.
Detach the image when finished by right clicking and ejecting it. or in the terminal type :
hdiutil detach /dev/disk#
Now, convert the image back to read-only
hdiutil convert -format UDZO -o new.dmg your.dmg -shadow
You now have a brand new dmg, and the time and space required to convert the image to read-write has been eliminated.