threefoldtech / 0-fs

A new filesystem for zero-os that leverage on unionfs and a thin fuse layer to get the files on demand
Apache License 2.0
0 stars 1 forks source link

user ids mapping issue on zos container #31

Open muhamadazmy opened 4 years ago

muhamadazmy commented 4 years ago

The problem is that ACL uses "usernames"/"groupnames" not uid or gid. Then 0-fs lookup the system the host system for the valid UID.

The problem now this mapping won't work for a container, imagine a container that has user "john" in its /etc/passwd that maps to UID 1000. But on the system there is no user john altogether . In that case 0-fs will assign UID 0 to the file, hence it will be owned by the root instead (inside the container)

The right way to do it is that the flist should preserve UID/GID instead of names (may be also keep name lookup but only use it if ids are not set)

Once the UID/GID are preserved the container will show the right name from its /etc/passwd file.

maxux commented 4 years ago

IMO, for sure, we have to keep UID and GID inside flist. I think it's better to keep mapped user/group for extended purpose and add UID and GID field on the ACL.

If the UID/GID is available, 0-fs directly forward this information and doesn't query anything on the host, this will fix lot of issues. If not available, fallback to username/groupname.