* Tobias Reif (tobiasreif / pinkjuice.com) [020602 03:54]:
> >I-nodes don't have the names and no portable way to access
> >i-node lists directly.  If it were possible, unprivileged users
> >should be denied, since it means to voilates file permissions.
> 
> You're right. But he could search it as root?

On a Unix system anyone can look at the filesystem entries associated
with inodes.  Use (e.g.) "ls -i" to see the inode numbers corresponding
to filesystem objects.  Traversing the filesystem, however, depends upon
permissions, as does reading the data from inodes.  The uid 0 user can
read all the data on the filesystem (unless the specific OS or
filesystem implements ACLs or attributes or capabilities which prevent
this; as a /general/ rule this is not the case).  Note that network
filesystems such as NFS require privileges on the server side.

Given sufficient privileges it is quite possible to do sophisticated
processing of inodes.  The downside for this particular thread is that
the inodes store the file data but are not concerned with what names may
be associated with the given inode(s) in the filesystem.

A related problem is that an inode may have a number of (even zero)
filesystem entries (filenames), and this information is not stored in
the inode entry.  A filesystem entry for an inode is sometimes called a
"hard link", particularly when people discuss multiple of them for an
inode.

Multiple hard links can be created via the command-line utility ln(1)
For obvious reasons "hard" links can only point to inodes within the
same filesystem.  These hard links are different from the "symbolic
links" created via "ln -s".  Those (symlinks) are somewhat akin to
(Windows) "aliases", but symlinks are older and don't depend on using
the contents of a file to specify the indirection.

To create an inode with no filesystem entry, create a file and write
some data to it, while keeping the file descriptor open, then call the
unlink() system call on the file.  The inodes still exist and are quite
useful, but there is no filesystem entry.  One advantage this has is
that if the process involved dies the OS cleans up the mess.  This can
be useful for temporary files in languages which don't have "ensure" ;-)

Rick
-- 
 http://www.rickbradley.com    MUPRN: 68    (88F/94F)
                       |  female bikini
   random email haiku  |  jello wrestling you are (as
                       |  always) invited.