Is there a way to password protect a directory in UNIX? Something like:
~$ cd dir
~$ Password:
~/dir$
Is there a way to password protect a directory in UNIX? Something like:
~$ cd dir
~$ Password:
~/dir$
The Unix way of doing it is through the existing permissions, make that directory, and its contents owned
by a specific owner and/or group and require everyone to su
to that owner or be part of that group to access the contents by removing read and write privileges from everyone but that user and/or group, su
will prompt for the password.
In theory you could do something along the lines of storing the directory content in an encrypted file and letting fuse
provider decrypt it into a filesystem - but first presenting the user with a dialog. (and presumably blocking the system calls to that filesystem until the user enters passphrase)
Dirty, but it could work.
Yes, it is possible. The solutions are those:
You could do some crazy thing like write your own 'cd' program which would authenticate the user and then use access control lists to change the directory perms to give them permission to the directory in question (and I guess recursively everything under it) and then call normal 'cd' to go into it. It would also have to somehow timeout and revert the perms or somehow determine that they had logged out. Definitely an ordeal.
First of all, there's no UNIX anymore effectively. Only UNIX-like. The likeness between them is too broad to be able to give you exact answer to the question in question.
Things that can be mentioned as related to what you're asking are: