How to make mount points inaccesible for any user or process in Ubuntu, when no filesystem is using it?

Posted on

Problem :

I have noticed that my mountpoints in /media often acquire underscores, double or triple at time, when I use Vuze which is configured to save the files on a mountpoint directory in /media.

This is very annoying as it often spoils the downloads and furthermore, it creates versions of files that are confusing I have to spend time resolving and deleting.

Is there any way to forbid access to a mountpoint, when there is no file system from /etc/fstab mounted on it?

Solution :

For filesystems with fixed paths like /home, I often chmod 000 the underlying directory so that I can’t accidentally put things there when the filesystem isn’t mounted. But the mountpoints in /media are created and removed dynamically (by udev, I think). You shouldn’t have leftover directories in there with nothing mounted on them; if you do, that’s the real problem you should be trying to solve. Mountpoints in /media are supposed to be automatically deleted when the filesystem is unmounted.

Leave a Reply

Your email address will not be published.