LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-03-2011, 07:38 AM   #1
nuspieds
LQ Newbie
 
Registered: May 2011
Posts: 3

Rep: Reputation: 0
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!
 
Old 05-03-2011, 08:15 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,610

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
It's not possible. Move the files into a folder that does not give any permissions to 'other' (nor 'group' if you want too).
 
Old 05-03-2011, 09:59 AM   #3
never say never
Member
 
Registered: Sep 2009
Location: Indiana, USA
Distribution: SLES, SLED, OpenSuse, CentOS, ubuntu 10.10, OpenBSD, FreeBSD
Posts: 195

Rep: Reputation: 37
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
 
1 members found this post helpful.
Old 05-03-2011, 11:32 AM   #4
nuspieds
LQ Newbie
 
Registered: May 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by AlucardZero View Post
It's not possible. Move the files into a folder that does not give any permissions to 'other' (nor 'group' if you want too).
Ok, thanks for the clarification.

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!
 
Old 05-03-2011, 11:38 AM   #5
nuspieds
LQ Newbie
 
Registered: May 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by never say never View Post
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.
Now that just might work! I'll have to test it and see, but the access is via a Media Center unit I have (as opposed to via another computer or command-line access). So as long as the Media Center unit does the equivalent of a regular "ls" without the parameter to also display hidden files, then I should get the results I'm looking for.

Thanks for the idea and the reference links! I'll do the test when I get home and let you know if it worked.
 
  


Reply

Tags
file, hidden, permission


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2: Prevent Directory Listing nick1 Linux - Software 10 02-21-2014 04:40 PM
[SOLVED] du style directory listing with file numbers JoatMan Linux - Newbie 5 09-09-2010 01:07 AM
FTP Server: Prevent user from getting out of their root directory Swakoo Linux - General 4 03-02-2007 01:42 AM
vsftpd and directory listing disable for user eugene2008 Linux - Software 0 07-06-2006 08:18 PM
how to prevent directory listing in apache ? chuck77 Linux - General 7 12-21-2001 03:27 AM


All times are GMT -5. The time now is 06:56 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration