----- Original Message ----- > From: "Dahong Tang" <[email protected]> > > On Thursday, August 8, 2013 11:42:31 AM UTC-5, Rob Owens wrote: > > ----- Original Message ----- > > > > > From: "Rob Owens" <[email protected]> > > > > > > > > > > ----- Original Message ----- > > > > > > From: "Dahong Tang" <[email protected]> > > > > > > > > > > > Here are the commands that I tested: > > > > > > > > > > > > $ sudo touch testvim > > > > > > $ ls -al > > > > > > -rw-r--r-- 1 root root 0 Aug 8 08:25 testvim > > > > > > $ vi testvim > > > > > > :w! > > > > > > :q > > > > > > $ ls -al > > > > > > -rw-r--r-- 1 user user 0 Aug 8 08:26 testvim > > > > > > > > > > > > I don't understand why vim would override both file permission > > > > and > > > > > > ownership. Any ideas? > > > > > > > > > > > > > > > > I can't reproduce this. When I enter :w! I get the following > > > > > message: > > > > > > > > > > "testvim" E212: Can't open file for writing > > > > > Press ENTER or type command to continue > > > > > > > > > > This is on a Debian Wheezy system with the packaged version of > > > vim. > > > > > > > > > I tried the above in the /tmp directory. When I try it in my own > > home directory, it indeed works like Dahong says. > > > > > > > > -Rob > > It's strange isn't it? You think nobody could mess with 644 files > that belong to you, but if another user has write permission to the > same directory, then he can overwrite your files using vim and > totally mess them up. I don't understand why this was chosen as the > default behavior of vim. Seems dangerous. > It does seem dangerous, but I don't think it has anything to do with vim. As root, I created a file in /home/rob. The rob user was able to delete that file after a warning about a write-protected file. Try it! I learned something new about linux file permissions today...
-Rob -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
