I am trying to learn about iNodes and file permissions. I thought that there is one inode that holds the permissions for a single file. The OS pulls a single inode into memory to check permissions for and single file. The slides from this book for my computer security class say that this is indeed how it works. But they also say that "several file nodes may be associated with a single inode." This seems contradictory. Is the book wrong? Did I miss something? What's going on?
(By the way, it's commonly called an inode, not an iNode.)
The book probably means this: several file names may be associated with a single inode. That is, the same inode may be reachable through several different names. In other words, one file can have more than one hard link.
Depends on what you mean by "file node" and "inode". I don't have that book, but I'm going to attempt to answer your question.
Traditionally, the term "inode" referred to the on-disk metadata about a file. This includes owner's ID, permissions, file size in bytes, and references to the disk blocks that contained the file's actual data. Oh, and a reference count.
Traditionally, a directory was just a file, with specially-formatted data, and a mark on its inode that indicated "this file constitutes a directory". Each entry of the specially-formatted data contained a name (in the form of a null-terminated array of bytes, a C-language string), and an inode number. From the inode number, the kernel could look up where to find the inode (the on-disk metadata). For every directory entry, the kernel's filesystem code was supposed to increment the inode's reference count. You can see this link count with the
The term "file node" may refer to the directory entry, essentially the name of the file. Many file names can refer to the same inode, each additional file name will increase the link count by one.
You can demonstrate a lot of this to yourself:
You should see identical numbers (the inode number) as the first field of