Hiding folders from console

Hi. I got assigned to work with a FreeBSD server box and one of the things I want to do in that box requires me to hide a group of folders which are in "/" and hence cannot be hiden with the leading dot trick. My qeustion would be, how do I hide folders so that without adding a dot in front of their name, they won't appear in the "ls" listings?
 
You can't. Why would you want to hide something?

If you don't want users to access it just set the correct permissions.
 
You can 'obscure' folders at most, like some rootkits do it. Create a directory with
Code:
[cmd=]mkdir \.\ [/cmd]
and put stuff in there. You can cd into it in the same way
Code:
[cmd=]cd \.\ [/cmd]
Most people will never notice.
Code:
drwxr-xr-x  47 user  user    2560 Jul 11 17:49 .
drwxr-xr-x   2 user  user     512 Jul 11 17:49 . 
drwxr-xr-x   3 root  wheel    512 Aug 22  2008 ..
 
Actually, what happens is that one of my m8's hooked an external HD full of pr0n to the server and placed it's mount point as /usr/tools and asked me if I could hide the entire /usr part so that if anyone outside of the small group that did this happens to be in front of the cli and lists the contents of "/" the "usr" and hence the mount point for the external HD are invisible.
 
Change the mount point and make it inaccessible to others?
Code:
mkdir /mnt/private/porn
chown porndude:privategroup /mnt/private
chmod 700 /mnt/private
mount /dev/porndevice /mnt/private/porn
 
fbsduser said:
Actually, what happens is that one of my m8's hooked an external HD full of pr0n to the server and placed it's mount point as /usr/tools and asked me if I could hide the entire /usr part so that if anyone outside of the small group that did this happens to be in front of the cli and lists the contents of "/" the "usr" and hence the mount point for the external HD are invisible.
I'd definitely recommend that you don't do it, just for job security reasons.

There's nothing that you can do that's going to completely hide it and root is always going to be able to figure out if there's an external HD mounted. Worse still is the fact that when it's mounted, everybody is going to be able to do enter the df command and know that something is mounted to that directory. And having something that's being randomly mounted somewhere nonstandard is a tad bit suspicious.

You could obscure it, but at some point somebody's going to ask about it. On top of that, FreeBSD is virus and root kit resistant, not virus and root kit proof.
 
Back
Top