I have a very basic question and still failed to find the answer after ~10 google requests and skimming through my unix textbook, so:
Consider a system with 2 hard drives, having root file system at /dev/sda1
and /home partition at /dev/sdb1
. Now, a process with UID=1000:GID=1000 wants to mount /dev/sdb1
file system at /mnt/backup
. I can imagine 2 scenarios of how it happens:
I wonder, under what UIDs and GIDs he freshly mounted file system is visible:
1. The UIDs and GIDs might be preserved, as on the picture.
2. The UIDs and GIDs on the mounted file system might be set to the mounting process's UID and GID=1000. If there were no UIDs and GIDs in the file system at all, this case takes place:
My questions are:
- In what situations cases 1 and 2 take place? What parameters of
mount
system call determine, which of them takes place? - In case 2, how do I determine the actual UIDs and GIDs of the files. In my example both
/mnt/backup/john
and/mnt/backup/jane
in the mounted filesystem are set to UID=1000, but in fact their UIDs were 1002 and 1003. How do I know them? - In case 1 what happens if the Jane's UID=1003 doesn't exist on the system?
/sbin/mount
(which may allow or refuse, depending on the content of/etc/fstab
) to temporarily gain priviledges to mount things. And my mistake, it's notcap_mount
, butcap_sys_admin