I want to block any kind of access to a certain directory unless a password is provided. It could be my root or account password.

The directory is residing on an NTFS partition, and this method needs to work for Windows as well, as I'm accessing the partition from both Linux and Windows interchangeably.

It could be implemented as encryption.

How do I achieve this?

  • 2
    If you can live with mounting and unmounting the directory manually when you need and are done with it, I suppose you could do that using something like Truecrypt. That'll also protect the contents from both sides of the OS barrier, something that only OS facilities rarely do. – a CVn Dec 21 '12 at 9:39
  • 1
    What is your OS? Apart from that - a filesystem is not an interactive gui. Where should that prompt go to when a script with no controlling tty touches that directory? – Nils Dec 21 '12 at 21:52
  • What do you want to do that for? Why do you think that is the best way of getting there? – vonbrand Jan 22 '13 at 1:25

TrueCrypt, or another encryption method, is probably the way to go with this.


Add ‘nouser’ option to the line in fstab which mounts your NTFS partition.

nouser is included in defaults macro (see man mount) The opposite options users and user shoudn’t be present.

  • This does nothing to protect the directory once the file system is mounted. It also does nothing to protect the directory from the Windows side. – a CVn Dec 21 '12 at 9:37
  • As OP said ‘It could be my root or account password’. in case of no ordinary user can mount filesystem, the root password is required. So it will work for linux, and you are wrong in your humble opinion that it does nothing. – tijagi Feb 4 '13 at 17:57
  • 1
    The OP also said "this method needs to work for Windows as well". And btw, I didn't downvote. – a CVn Feb 5 '13 at 10:27

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.