I got some files in directory:
drwxrws-wt 2 me mygroup 4,0K 10.1. 12:34 . -rw-r----- 1 someone mygroup 10G 10.1. 11:22 someonesfile
someone are regular users without supplementary groups.
How to take ownership of that file using
$ chown me someonesfile chown: doing bla bla bla: permission denied
me can "change" ownership by replacing file with new one:
cp someonesfile myfile && mv -f myfile someonesfile`
So my main question is if there is any easier (cheaper) way to change file ownership in described environment without using root account or other privilege elevations. Basically I wanted to know if
me can somehow take advantage of directory permissions to somehow reset ownership/permissions without making copy of whole file.
I've also noticed that editing file with
vim and forcing overwrite with
:w! will change owner of file, is that same as doing
cp && mv? At least
touch someonesfile will fail with permission denied.