Skip to main content
Post Closed as "Duplicate" by muru, Kusalananda
added 22 characters in body
Source Link
Andy Dalton
  • 14.7k
  • 1
  • 29
  • 50

I have a directory named dir1dir1, owned by rootroot, with permissions 777 set777. I have a file named file1file1 inside of dir1dir1, owned by rootroot, with permissions 644 set644. I'm logged in as a normal user named user1user1.

Why is it that if I edit file1file1 inside vim, which states that it is a readonly file, I can save it via 'wq!'wq!? My expectation is that unless I sudosudo in, I ought to be denied write access.

I have noticed that following the edit, the ownership of file1file1 has changed from rootroot to user1user1. I also noticed, if I change dir1dir1 permission to 775775, my expectations are met. That is, I am denied write access.

I have a directory named dir1, owned by root, with permissions 777 set. I have a file named file1 inside of dir1, owned by root, with permissions 644 set. I'm logged in as a normal user named user1.

Why is it that if I edit file1 inside vim, which states that it is a readonly file, I can save it via 'wq!'? My expectation is that unless I sudo in, I ought to be denied write access.

I have noticed that following the edit, the ownership of file1 has changed from root to user1. I also noticed, if I change dir1 permission to 775, my expectations are met. That is, I am denied write access.

I have a directory named dir1, owned by root, with permissions 777. I have a file named file1 inside of dir1, owned by root, with permissions 644. I'm logged in as a normal user named user1.

Why is it that if I edit file1 inside vim, which states that it is a readonly file, I can save it via wq!? My expectation is that unless I sudo in, I ought to be denied write access.

I have noticed that following the edit, the ownership of file1 has changed from root to user1. I also noticed, if I change dir1 permission to 775, my expectations are met. That is, I am denied write access.

Source Link

Unexpected ability to write to file

I have a directory named dir1, owned by root, with permissions 777 set. I have a file named file1 inside of dir1, owned by root, with permissions 644 set. I'm logged in as a normal user named user1.

Why is it that if I edit file1 inside vim, which states that it is a readonly file, I can save it via 'wq!'? My expectation is that unless I sudo in, I ought to be denied write access.

I have noticed that following the edit, the ownership of file1 has changed from root to user1. I also noticed, if I change dir1 permission to 775, my expectations are met. That is, I am denied write access.