I want to mount a dmg as nonremovable image using AppleScript as described here. The difference is that my dmg is encrypted.
When I execute
do shell script "hdiutil attach /path/to/my.dmg -notremovable" with administrator privilege
root password is asked and then nothing happens (I'd expect a prompt for dmg's password) and the script runs until closed in Activity Monitor.
If the script is executed without "with administrator privilege"
then the dmg's password is asked right before I get "hdiutil: attach failed - Permission denied" error.
The console version works fine:
sudo hdiutil attach /path/to/my.dmg -notremovable
Why AppleScript does not ask for the dmg's password? Does it "hide" the second prompt for some reason?