Stefan Lambrev wrote:
> Can someone explain to me why next can happened on freebsd:
> 1. add 2 users in same group - user test and test-ro in group test
> 2. as user test: cd /home/test ; mkdir test; chmod 775 test; echo
> "asdasd" > ~/test/del.me
What was your umask? I assume 022, i.e. the file was
created with mdoe 644.
> 3. su - test-ro ; cd /home/test; vim del.me - make changes; force save
(:x!)
I suspect that vim -- upon force save -- deleted the
original file, which is perfectly possible because the
test-ro user had write permission to the directory.
Then vim created a new file with the same name, which
is again perfectly possible because of the writability
of the directory. The new file belongs to the test-ro
user, of course.
So ...
> ls -l
> total 2
> -rw-r--r-- 1 test-ro test 10 Nov 29 18:19 del.me (how is that possible
?)
>
> back "su - test" and try to edit this file - impossible!
.. That's to be expected.
> I do not know what the RFC says about it, but it is ultra weird for me
> that such ownership takeover is possible.
It is standard and perfectly correct behaviour.
There was no "ownership takeover". One file was deleted,
and a new file was created, all allowed by the given
permissions.
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
"If Java had true garbage collection, most programs
would delete themselves upon execution."
-- Robert Sewell