Bug 1478622 - FILE PERMISSIONS ARE REVERTING BACK TO PREVIOUS OWNER WHEN WE ARE USING VIM EDITOR
FILE PERMISSIONS ARE REVERTING BACK TO PREVIOUS OWNER WHEN WE ARE USING VIM E...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: vim (Show other bugs)
7.0
All Linux
unspecified Severity high
: rc
: ---
Assigned To: Kamil Dudka
BaseOS QE Security Team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-05 04:04 EDT by shanmukh
Modified: 2017-08-07 04:12 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-07 04:12:27 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description shanmukh 2017-08-05 04:04:37 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)

How reproducible:
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.



Actual results:

changing file permission from user 2 to user 1. 
Expected results:
should not change the permission when we are forcefully quitting.

Additional info:
Comment 2 Kamil Dudka 2017-08-07 04:12:27 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.