This is not about UNIX / Linux, but about the implementation of the file system, but yes, Unix / Linux uses inodes at the kernel level, and the file system implementations have inodes (at least virtual ones).
In general, symbolic links are simply files (btw, directories are also files) that have:
- a
file-type flag in "inode" that tells the system that this file is a "symbolic link" - file-content: path to the target - in other words: a symbolic link is just a file that contains the name of the flag file in the inode.
Virtual file systems can also have symbolic links, so check out FUSE or other sources of file system implementations. (Ext2 / Ext3 / ufs..etc)
So,
Is the inode answer on UNIX / Linux?
depends on the implementation of the file system, but yes, usually the inode contains a βfile typeβ (and owners, permissions, timestamps, size, pointers to data blocks). There are file systems that do not have an inode (in physical implication), but have only "virtual inodes" to ensure kernel compatibility.
If so, will the inode number be the same for purposes and references?
No. Usually a symbolic link is a file with its own inode (with a file type, its own data blocks, etc.).
If so, can the inode index have permissions other than the access permissions of the target inode (if it exists)?
This is about how symlink files are handled. Typically, the kernel does not allow changes to symlink permissions - and symlinks always have default permissions. You could write your own file system that would allow different permissions for symbolic links, but you would run into a problem because regular programs like chmod do not change permissions for symbolic links, so creating such a file system is senseless anyway )
To understand the difference between hardlinks and symlinks, you must first understand directories.
Directories are files (differentiated by the inode flag) that tell the kernel "treat this file as a map from file-name to inode_number ". Hard links are simply file names that map to the same inode . Therefore, if the directory file contains:
file_a: 1000 file_b: 1001 file_c: 1000
the above means that there are 3 files in this directory:
- file_a described by inode 1000
- file_b described by inode 1001 and
- file_c is again described by inode 1000 (therefore it is a hard link with file_a, not hardlink to file_a), because it is impossible to determine which file name was first - they are identical).
This is the main difference from symbolic links, where inode file_b (inode 1001) can have the content "file_a", and the flag means "this is a symbolic link." In this case, file_b will be a symbolic link pointing to file_a .