Basically, What is going on here and what am I not understanding?
I have a set of subuids for my user. I want to chown a file to specific subuid which is part of this user's allocation
administrator@host:/home/administrator$ cat /etc/subuid
root:100000:65536
administrator:165536:65536
administrator:1000000:9000001
administrator@host:/home/administrator$ cat /etc/subgid
root:100000:65536
administrator:165536:65536
administrator:1000000:9000001
Trying to chown this file is failing despite this subuid being part of the allocation.
administrator@host:/home/administrator$ ls -lhat
...
-rw-rw-r-- 1 administrator administrator 229 Aug 2 13:00 file
drwxrwxr-x 7 administrator administrator 4.0K Aug 2 13:00 ..
administrator@host:/home/administrator$ chown 1500000:1500000 file
chown: changing ownership of 'file': Operation not permitted
administrator@host:/home/administrator$ stat file
File: file
Size: 229 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 658357 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/administrator) Gid: ( 1004/administrator)
Access: 2018-08-02 13:00:36.529197108 +0000
Modify: 2018-08-02 13:00:36.529197108 +0000
Change: 2018-08-02 13:00:36.529197108 +0000
Birth: -
administrator@host:/home/administrator$
However, I can remove the file as user, if I use sudo to chown it - but it shows as a write protected file when I do. This indicates I do in fact have permissions to modify files with this subuid.
administrator@host:~$ touch file
administrator@host:~$ chown 1500000:1500000 file
chown: changing ownership of 'file': Operation not permitted
administrator@host:~$ sudo chown 1500000:1500000 file
administrator@host:~$ rm file
rm: remove write-protected regular empty file 'testfile.txt'?
administrator@host:~$
Can anyone explain the inner workings which is going on here? I've probably misunderstood something basic somewhere. I can't tag this as subuid because not enough rep, so I'll use uid.
Thanks!