I am trying to understand why does POSIX behaves in this wierd manner.
1) I created two users "user_a" and "user_b" and both belongs to same "group"
2) sudo "user_a".
a) Created a Dir /home/users/dir_1. The owner is "user_a" and permission is 777.
b) Created a file /home/user/dir_1/file.txt with permission 644 and owner is "user_a"
3) sudo "user_b"
a) cd /home/user/dir_1
b) echo "test" >> file.txt fails with "Permission Denied" as expected.
c) vi file.txt opens the file warns its a "Read Only" mode. Then I write at the end of file and close vi with !wq. BOOM, the write succeeded and I verified using cat that the write got commited to the disk.
Why on earth Unix allows to write using 3.c but fails during 3.b.
3.c should have failed with "permission denied" but it does not