Sometime Today, abhilash kumar assembled some asciibets to say:
Consider a file with read-only permissions for all that is r--r--r-- is a directory with permissions of 777. The owner of the file is say a user "abc".
1.Any other user say "xyz" can write to this file after opening it with vi using a forced write(wq!). 2.After the forced write "xyz" becomes the owner of the file.
What are the permissions for the directory that the file is in?
If the directory is writable by anyone, then a forced write will delete the original file and create a new file owned by the new user.
To avoid this, either don't make the directory writable by anyone, or turn on the sticky bit of the directory (chmod +t directory_name)