I suggest that I have a log file with 666 permission and its owner is alice. So user 'bob' can change its owner by this:
cp log log.temp; rm log; mv log.temp log
So how can I fix this risk?
This question came from our site for professional and enthusiast programmers.
As Andrey says above, bob can only do what you say if he has rights over the directory which contains the file. Just change the dir permissions to xx5 if you want bob to access but being unable to create new files.
Access permissions for files and folders mean different things from the user standpoint.