I have a share directory with another user, say Bill. The directory has permission as 775. I create my own file with the same permission in the directory. My file has owner and group as my user account. If I log in as user Bill, and use vim, I see read-only warning. However, if Bill write to the file, he still can save it. And now the file owner and group belong to user Bill.

This is not what I expected. How can I prevent Bill to edit my file, and only allow to read it?

  • Does the directory have to have group write permissions?
    – muru
    Feb 5 '16 at 17:50
  • Sticky bit permission
    – Qasim
    Feb 5 '16 at 17:55
  • @muru: yes it is
    – pmh
    Feb 5 '16 at 21:12

File permissions and vim (ro) warnings are not the same thing.

If vim is giving you are ro warning on a file with 755 permissions, then, my guess is either the file is in use of was not saved.

See https://superuser.com/questions/218262/how-to-get-rid-of-the-warnings-when-opening-a-file-that-has-a-swp-file or give details of the vim error.

File permissions are detailed here https://help.ubuntu.com/community/FilePermissions

You probably want file permissions of 644 or 640

See also acl How do I set up a folder so that anything created in it inherits permissions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.