How does one create a directory that can’t be seen and can only be accessed via its absolute path name

directory

I'm working on an assignment on adding time support to a standard UNIX system. Part of it, however, involves securing the location of backup files (which we've set to be at the system root by default) by making them invisible, even through a command like "ls -al" and can only be accessed by specifying its absolute path name. Here's the original quote:

Finally, historical directories should be "virtual", in the sense that
they do not appear when examining the contents of the inode
representing the root directory or when performing a command like "ls
-al /", and are only accessible through a direct chdir() ("cd") operation to a historical pathname.

I've been prowling through the UNIX file system API but I haven't come up with a way to enforce this (I'm thinking a command line program or a combination of these in a bash script might do the job). Am I thinking in the wrong direction?

Would appreciate any pointers or tips in the right direction, thanks 🙂

Best Answer

You can remove read permission from a directory. In that case it is still possible to access its content (files or subdirectories, given that their permissions allow it) but you must know (or: try...) their name as listing of the directory content is not possible any more.

Related Question