LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Hide files with permissions? (https://www.linuxquestions.org/questions/linux-newbie-8/hide-files-with-permissions-413241/)

TomalakBORG 02-08-2006 09:29 PM

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

gilead 02-08-2006 09:38 PM

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.

mmaki 02-08-2006 09:46 PM

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.

Electro 02-08-2006 10:36 PM

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.

spooon 02-09-2006 12:10 AM

just take away read permission from the directory for other users

Dtsazza 02-09-2006 07:56 AM

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.

Electro 02-09-2006 03:41 PM

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.

Dtsazza 02-09-2006 04:16 PM

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! :)

TomalakBORG 02-09-2006 07:25 PM

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.

Electro 02-09-2006 08:39 PM

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".

gilead 02-09-2006 09:07 PM

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.

TomalakBORG 02-10-2006 11:37 AM

ACH! hide unreadable is just the thing I was looking for! Thanks much, I will impliment it tonight and see what happens.

TomalakBORG 02-10-2006 05:09 PM

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


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