MacOS – Disable network drive unmounting

automountmacosmountNetwork

I've got a pretty specific need – to disable unmounting a network drive through the regular Finder eject function (accessed either by right-clicking the mounted drive on the desktop, or clicking the eject button in Finder). This is on OS X 10.8 Mountain Lion.

Basically I need to stop other users of the Mac unmounting a drive volume. I'm happy if unmounting is still possible by other means (terminal etc.) My users do not purposefully eject the drive, it's usually accidental – e.g. when trying to eject a USB drive, or just a mis-click. I'd like to prevent the ejecting/unmounting entirely.

Anyone have a way to do this? Have been searching for a while, never found a solution.

Edit 1: I should also note this is an smb network drive, but may also need same function for an afp drive

Edit 2 [9/1/13]: I had another idea, albeit problematic. With defaults write com.apple.finder ProhibitEject true I can disable ejecting any volume completely. Unfortunately this won't do in my circumstance, I need users to be able to plug in portable USB drives.

Best Answer

You could open a terminal window and change to the network path so that the file system is marked as in use. You could also open a file or application on the drive.

The users might still choose to force eject, so it's not a proper ban on ejecting the volume, but it adds another roadblock.