This is not possible because it will open a loophole in access control rules. Whether a file can be opened depends not only on its own access bits, but also on the resolution bits of each containing directory. (For example, in your example, if test.txt
was in 644 mode, but the containing test
directory was in 700 mode, then only root
and the owner of test
could open test.txt
.) The inode numbers only identify the file, not the directories (possibly the file is located in several directories, read "hard links"), so the kernel cannot perform a full set of access control checks with only the inode number.
(Some Unix implementations suggested non-standard root-only APIs to open the file by inode number, bypassing some access control rules, but if current Linux has such an API, I donβt know about that.)
source share