Red Hat Bugzilla – Bug 1478622
FILE PERMISSIONS ARE REVERTING BACK TO PREVIOUS OWNER WHEN WE ARE USING VIM EDITOR
Last modified: 2017-08-07 04:12:27 EDT
Description of problem:
file permissions are reverting when we are using vim
Version-Release number of selected component (if applicable):
Redhat enterprise (7.0)
First create two users(user 1 and user 2).And two users are not in sudoers file (normal users).
Steps to Reproduce:
1.Create a file using user 1 (file will have all ownership permissions with user 1)
2.Now change the ownership permission to user 2 (include no read,write,excute permissions to others or groups.file should have permission only for user 2)
3.now vim the file with user 1 and try to append the data, it will not allow you to append because user 1 don't have permission to append the data.
4.now press :wq!(forcefully quit from vim)
5.check the file permission it will change the permission from user2 to user1.
changing file permission from user 2 to user 1.
should not change the permission when we are forcefully quitting.
As long as the user running vim has write access to the _directory_ where the edited file resides, vim is able to unlink the existing file and create a new file with the same name. It does not matter which permission/owner/group the edited file had. This is just how the file system works, nothing specific to vim. You can achieve the same behavior with 'cp -f' for example.