Disk Image Mounts Itself

I have a script the basically cleans up my desktop, empties the trash, takes care of some odds and ends, and logs me out. One of the odds and ends is ejecting a disk image, creatively named “Disk Image”, which is sometimes mounted.
I use this script:

	set theDisk to "Disk Image"
	do shell script "diskutil unmount " & quoted form of ("/Volumes/" & theDisk)
end try

This does eject the disk, but when I log back in, it automatically re-mounts itself. I’ve confirmed that it is not remounted until I log back in. It is an encrypted DI but the automatic mount doesn’t prompt me for a password before mounting. I have not saved the password to the keychain.

Is this just a problem with the code I’m using (I’m not good with even simple shell scripting), or could it be something else all together? Any help is greatly appreciated.

Model: iMac
AppleScript: 2.3 (118)
Browser: Safari 537.11
Operating System: Mac OS X (10.6)

Can it be possible that is mounted as root? that can be possible if you’re prompted for an administrator user name and password when mounted.

When a disk image is mounted as root it remains persistently mounted. If a volume is mounted as a regular user (both admin and non-admin) then it will be unmounted when a user logs out (since panther). It doesn’t seems that it re-mounts after re-login.

The only problem with that is this. Normally when I don’t eject the disk image I’m able to see it on another user’s desktop, though access will be locked to them. After running this script, to test the problem, I logged into another admin account on the same computer to see if I could see the disk, but it wasn’t there. It only reappeared after I logged back into my own account. Thats how I know it is successfully ejecting but then then remounting on login.

If it was mounted as root, wouldn’t it not eject at all without a “sudo” command?

Is, maybe by accident, the disk image located in the login items for the user? Or is the disk image password stored in the keychain? Because the things that you describe that happens aren’t default.

No neither of those are it.
What application do I need to tell to eject the disk?
Any ideas?

On the commandline? hdiutil and hdid