I'm not sure if this will make sense but I'm having a problem.

I have an external hard disk drive that I'm using for my torrent files. It is mounted using fstab.

Now here's a problem, some times maybe because of power interruptions, my HDD is unmounted and (rarely) failed to remount. When this failure of remount happens, the torrent downloads are continued on the mount point (example: /home/user/Downloads).

My question is, is there a way to make /home/user/Downloads as read-only and then make it write-able only if the HDD is mounted?

Or any other better solutions are most welcome.


You could make /home/user/Downloads be a link to a directory deeper in on the mount, which is mounted elsewhere. That would probably cause the torrent download to fail.

E.g., if the target directory is /user/Downloads on the HDD, which is mounted on /HDD, then /home/user/Downloads should be a link to /HDD/user/Downloads, and that directory certainly doesn't exist unless the HDD is mounted.

  • Thanks! I think I got your idea but I'm not sure how to link... I can change the fstab to mount the HDD somewhere and link it to /home/user/Downloads. But how do I link it? and would the link be permanent? – Reigel Nov 22 '16 at 3:25
  • link is done with a command: ln -sTf /HDD/user/Downloads /home/user/Downloads but there shouldn't be a /home/user/Downloads beforehand. The link stays there, but is called "a broken link" when the HDD is not mounted. – Ralph Rönnquist Nov 22 '16 at 3:34
  • thanks I got it... one question though, not yet mounted, if I do mkdir /home/user/Downloads/test it fails, which I'm inspected it to. But if I add a sudo I'm kind of surprise it works. Is this ok? But maybe not a problem because my torrent is not run by root.. – Reigel Nov 22 '16 at 3:51

When you are mounting a drive, the mount point's permissions are changed by permissions of device's root directory.

So yes, you could be able to change permissions on your mount point /home/user/Downloads so your user won't be able to access it. Then, after mounting your external drive you will need to adjust permissions of root directory of your drive (again accessible as /home/user/Downloads after mounting it).

From now on, empty mount point won't be readable by application run as unprivileged user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.