I am working with CentOS 8 and I have a problem with UIDs and User Names. I have installed VestaCP to manage my websites. The user by the name of "user123" and UID 1007 is the owner of all the websites (user in VestaCP). Then I have created individual FTP users for each website. Each FTP user has the following name format: "user123_random", where random is a random text. Each FTP user has a different name, but they all share the same UID (1007) (this is the default behavior when creating new FTP users).
Now the problem happens when I am checking the ownership (user) of each website or file inside that website. So technically, the owner belongs is UID 1007. The problem here is that CentOS 8, for some reason, it is showing "user123_random" as the owner of the websites instead of "user123".
The curious thing is that when I do a "id -nu 1007", it returns the name of the last FTP user created with the prefix "user123_". So I assume, this is what CentOS 8 does internally, showing the last username (with same ID 1007) as the owner of a file/directory. This is not how CentOS 7 worked. CentOS 7 would show "user123" as the owner of the files, irrespective of adding new FTP users with the same UID.
The question is...is there a way to change this behavior in CentOS 8, so that it behaves as CentOS 7? So that the inverse name search by UID returns the "first created user" with that UID.
I would use a different solution. I would add all those users in 2 groups, one group to give read-only access, and another group to give read-write access. Then I would use extended POSIX ACLs to give those groups permission on the folders and files. You can set a default permission to be inherited. And with setGID I would set the group for new files and folders.
For details see the man pages for: chmod, chown, setfacl, getfacl, ls