Mark Hounschell wrote:
Paul Varner wrote:
It is because of the directory permission. Do an ls -ld /home/markh and I am sure that they are set to drwxr-xr-x or (755) Since you own the directory and have write priviledges the editor is allowed to write the file and change the ownership. If you create another directory with the permissions set to 555 (dr-xr-xr-x), the behavior will act like you are expecting.
Regards, Paul
So in linux there is no way to have some files in "a" directory that are writable and some files that are not? At least not without the use of acls? This is really what need to achieve but didn't want the hassle of learning acls or having to put acl support in my kernel. I'm not using SuSE's kernel.
If you own the directory and have read/write permission then things like this can happen. What is happening is that vim is trying to be helpful and do what you told it to do. Since you gave it a w! command, it takes that to mean "I really really want to write this file" and what vim did was delete the original using the unlink system call, created a new file with the same name using the open system call, wrote its buffers to the new file and when you quit it closed the file. Since the read/write directory permissions allow you to remove and create files, vim successfully wrote the file. Not all editors will exhibit same behavior. I know that on a Solaris box, the vi command will not write a file if you don't have write permissions on the file. Regards, Paul