How can I prevent a user from seeing a file in a directory listing?
Hi,
I hope that I am posting this in the right forum. I have, for example, a folder called "MyFolder" and it contains 3 files: MyFile1, MyFile2, MyFile3. The only file that I do NOT want a particular user/group to even see that it exists is, for exmple, MyFile2. So, when they do a directory listing on MyFolder, they should only see MyFile1 and MyFile3. How can this be done in Linux? The important thing is that it is not just preventing them from "executing" MyFile2, but to prevent them from even knowing that it exists by not including it in a directory listing. This is a simpified example using one file, but in reality, I have lots of files and some of those that I want to block are also subfolders. It is very important for me to hide the existence of certain files/folders when the user does a directory listing. It's also important that the files stay in their current folder (that is, I can't use a workaround which requires moving all the files into a separate folder and then securing that folder). Please let me know if this is possible and if so, how. Thanks! |
It's not possible. Move the files into a folder that does not give any permissions to 'other' (nor 'group' if you want too).
|
Well you can make the file hidden, (in linux files that start with a period are hidden) but that will not prevent someone from listing hidden files, and you can set permissions on the file to prevent certain groups for opening or executing the file. But you can't just make it like it doesn't exist.
For an understanding of hiding files (not for security) http://www.felgall.com/lincmd5.htm For a better understanding of permissions check out http://www.zzee.com/solutions/linux-permissions.shtml also refer to man chown and man chmod |
Quote:
Moving the files into another folder is the last thing I wanted to do becuause I hate splitting up my content. I'd much prefer to create whatever organizational structure I wanted and then secure it accordingly. But, hey, since it's no possible, then I'll just have to manage somehow. :) Thanks! |
Quote:
Thanks for the idea and the reference links! I'll do the test when I get home and let you know if it worked. |
All times are GMT -5. The time now is 06:03 PM. |