[root@MGWSDT_FEWS ~]# ll file
-rw-r--r-- 1 root bill 0 Aug 14 17:28 file
[root@MGWSDT_FEWS ~]# su - bill
$ vi /root/file
I edited this file and wq!
Now bill becomes the file owner:
$ ll /root/file
-rw-r--r-- 1 bill bill 16 Aug 14 17:29 /root/file
Why? So strange!
bill cant edit the file. hess part of the group which only has read access.
So switching to bill you would expect a permissions error when you try and write.
In this case bill is also the directory owner, so whats actually happening is the file is being removed, and recreated now with bill as the owner.
would write as root and keep the permissions