"Unix world" filesystems (like ext4) store for each file, in the inode a list of permission/access rights for the 3 types of available users owner,group,other. I want to know when the "authentication" happens; what I mean is:
let's say we have a file
file.txt rwx rw- --- st_uid=54 st_gid=99
owner group others
user tim
having uid=100
, gid=99
runs cat file.txt
in the terminal, the request gets to the filesystem which compares tim
to the permisions of the file;
tim
is not the owner: his uid=100
not the same with file's uid=54
;
but he has the same gid as the file (99
), so the response he gets is rw-
cat
is actually a read so the user recieves the content
In which system function is this scenario executed? Can I modify it by implementing a custom filesystem?
UPDATE: the sole purpose of my filesystem is to mess a little more with the permissions and be a proof of concept (it's a research project) so any ideas about where I should start would be highly appreciated. Thanks in advance!!
The solution is straight forward with respect to a FUSE filesystem: The FUSE implementation provides a context for each user request made to the filesystem;
The workflow looks like this:
ls
)