Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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. – Michael Kjörling Dec 21 '12 at 9:39
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
up vote 0 down vote accepted

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

share|improve this answer

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.

share|improve this answer
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. – Michael Kjörling 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
The OP also said "this method needs to work for Windows as well". And btw, I didn't downvote. – Michael Kjörling Feb 5 '13 at 10:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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