LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How can hide the folders in linux (http://www.linuxquestions.org/questions/linux-hardware-18/how-can-hide-the-folders-in-linux-258714/)

alnreddy 11-24-2004 04:53 AM

How can hide the folders in linux
 
hi,
How can hide the folders in linux ?
I am able to restrict file or folder access.
but i am unable to hide it. please help me.

b0uncer 11-24-2004 04:58 AM

well, actually there is no way :) but some filemanagers like Nautilus for example (and Konqueror too I think), if not set otherwise, tend to hide every file ("folders" are actually files of one kind too, so they too) that begins with a dot, like

.xinitrc
.hidden_file
.
..

the . (just one dot) file represents the current directory (by doing a "cd ." you get only back to the place you're currently in) and .. (two dots) represent the directory that's one step "up" from you - like /home if you're in /home/user. so these things are files too, and hidden because they start with (or consist of) a dot. so rename a file so that you put one single dot in front of it's name, and some filenamagers will hide it.

still: if you want to see them, there's no restrictions: hiding dot-files is only a habit, and when forced, they can be viewed with every app that's capable of viewing file names, I think :) (unless some wicked coder has coded otherwise)

theYinYeti 11-24-2004 05:15 AM

Hiding files and folders beginning with a . is a Unix rule. It must be followed by all applications, though, as you say, it is permited to explicitely ask to view them.

But renaming a file/folder by prepending its name with a dot is not always feasible. This can be done with most, but not with files/folders that have special meaning. Examples:
- evolution is Evolution's settings directory. If you change it to .evolution (becomes invisible), Evolution will not run.
- .mozilla is Mozilla's settings directory. If you change it to mozilla (becomes visible), Mozilla will not run.

But not all is lost. If you really want to hide something, while leaving its name intact, there's the GoboHide kernel patch from the GoboLinux project. You have to compile your own kernel, though.

Yves.

vectordrake 11-24-2004 05:58 AM

How about with chmod? Something like
Code:

chmod ug-rwx <filename>
Is that right?

theYinYeti 11-24-2004 07:00 AM

No. This should keep you from:
- Read the content,
- Write (add or remove) files inside,
- X: cross the diretory (go inside or under it).
But this will not keep you from viewing that the directory is there; it will get listed.

Yves.

vectordrake 11-24-2004 08:04 AM

I haven't had a need to do this, so I wasn't sure. However, if I try to browse a directory owned exclusively by root, I cannot see its contents. Perhaps, then, it would work if one were to "hide" the chosen directory inside one that has been assigned these permissions. Then, the desired folder to be hidden would be "hidden" as it would be content of the directory with permission restrictions. I know that I cannot recurse a directory owned by root on my system unless I "su" to root. Its a thought.

One who seems to know a lot about security on *nix is chort, who you'll find moderating the *BSD furums here. Perhaps he could help with an idea.


All times are GMT -5. The time now is 01:55 PM.