LinuxQuestions.org
Help answer threads with 0 replies.
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 02-08-2006, 09:29 PM   #1
TomalakBORG
Member
 
Registered: Dec 2004
Posts: 245

Rep: Reputation: 30
Hide files with permissions?


Hey guys, here's what I would like to happen -- not sure if it can be done though. I want people who have no business with a file to not even see it exists.

Let's say we have a file called foo.txt
foo.txt belongs to cooluser:coolgroup and has permissions 750

As it is, if a user named 'tux' comes along (and does not belong to coolgroup) tux cannot view/modify/delete/execute/anything the file... but tux can still see it's there. Is there any way to set files to be hidden from certain users based on their permissions or otherwise? Even if this can not ever be done I'd like to know that.

-Bill
 
Old 02-08-2006, 09:38 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
If you take away permissions for the directory containing the file they won't be able to see the file exists. I don't think you can do anything more than what you have done to the file though.
 
Old 02-08-2006, 09:46 PM   #3
mmaki
Member
 
Registered: Nov 2005
Location: Thousand Oaks, CA
Distribution: Debian
Posts: 33

Rep: Reputation: 15
I believe the only way to hide a file is to keep them out of the directory the file is in. Take away r and x permissions on the directory. w permissions is meaningless without x.
 
Old 02-08-2006, 10:36 PM   #4
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Nope, UNIX or Linux permissions are read, write, execute, setuid, setgid. The only way to hide a file or directory is to place a period before the name. I think NFS or SAMBA can do it though.
 
Old 02-09-2006, 12:10 AM   #5
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 50
just take away read permission from the directory for other users
 
Old 02-09-2006, 07:56 AM   #6
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
Quote:
Originally Posted by Electro
The only way to hide a file or directory is to place a period before the name.
Even then, that doesn't equate to 'hide' in this context - it's just a hint to directory listings to suppress it by default. Bash's autocomplete will list dot-hidden files by standard, and it's very easy to see them in almost any other context. Hiding files like this is essentially a way of stopping seldom-used files and directories from cluttering up your standard directory view unnecessarily.
 
Old 02-09-2006, 03:41 PM   #7
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Quote:
Originally Posted by Dtsazza
Even then, that doesn't equate to 'hide' in this context - it's just a hint to directory listings to suppress it by default. Bash's autocomplete will list dot-hidden files by standard, and it's very easy to see them in almost any other context. Hiding files like this is essentially a way of stopping seldom-used files and directories from cluttering up your standard directory view unnecessarily.
You sound like I should be hung. I told the truth, but other posters just said to not include read, write, execute on a file although the question was to hide the file. The only way to definitately hide the file from the user is to move it to a directory that the user can not access.
 
Old 02-09-2006, 04:16 PM   #8
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
Sorry if I came off like that, I didn't mean to say that your advice was wrong, and I'm sure you knew everything I said anyway. I just wanted to clarify things for the sake of the OP and anyone else reading the post!
 
Old 02-09-2006, 07:25 PM   #9
TomalakBORG
Member
 
Registered: Dec 2004
Posts: 245

Original Poster
Rep: Reputation: 30
Thanx guys - this helps a bit to know I can't exactly pull it off

Electro - you said SAMBA could do it? I am in fact trying to impliment this on a shared directory, so if smb could pull it off I'd love to know how.
 
Old 02-09-2006, 08:39 PM   #10
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
I said I think, but I recently check the smb.conf manual. It is possible to hide files in SAMBA by including "hide files". Also there is "hide unreadable" and "hide unwritable".
 
Old 02-09-2006, 09:07 PM   #11
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
Electro is correct about the hide files option (I haven't used hide unreadable or unwritable). There is also a veto files option.

hide files specifies a list of files that will have their msdos attribute set to hidden and veto files just won't display them at all. Have a look at http://us1.samba.org/samba/docs/using_samba/appb.html for more info.
 
Old 02-10-2006, 11:37 AM   #12
TomalakBORG
Member
 
Registered: Dec 2004
Posts: 245

Original Poster
Rep: Reputation: 30
ACH! hide unreadable is just the thing I was looking for! Thanks much, I will impliment it tonight and see what happens.
 
Old 02-10-2006, 05:09 PM   #13
TomalakBORG
Member
 
Registered: Dec 2004
Posts: 245

Original Poster
Rep: Reputation: 30
YES! I added 'hide unreadable = yes' into the share's section of smb.conf and everything is great. Thanx a bunch for the help -- I had thought something like that existed but couldn't find it anywhere!

-BIll
 
  


Reply


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
how do I hide files? joshknape Linux - Newbie 11 09-12-2005 09:26 PM
How to hide files in Linux bngrhl Linux - Newbie 8 05-23-2004 08:36 AM
Setting permissions to files. lonny Linux - Newbie 1 12-08-2003 07:09 PM
Samba won't hide dot files josephswagner Linux - Software 1 02-25-2003 08:25 AM
How could i hide some files in the share directory(samba) whepin Linux - General 1 12-20-2001 07:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:23 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration