CentOs 6.3 - Permissions

Hi…
I have
A directory : /home/ABC having rwx for all users (owner, group, other) [rwxrwxrwx]
Three users: test1,test2,test3

Scenario:
test1 create file f1 inside ABC and all the permissions for all users are taken away. [- - - - - - - - -]
test2 opens ABC and edits f1 through vim editor and then saves it using override. [wq!]

Result:
now test2 becomes user and group owner of f1 and also new contents are stored and original file was overwritten.

Please tell me when f1 had no permission for anybody, how test2 was able to overwrite the file and take its ownership?

Hi,

I’m not entirely sure of what exactly happened with your lost permission bits and thus a full command line output will be great to rectify this issue. However, it seems that what your are talking about and what you need is a sticky bit. Simply set your /home/ABC directory with a sticky bit:

# chmod +t /home/ABC

The sticky bit will now prevent users from deleting or renaming files they do not own. Visit the following page for more information and examples on what is sticky bit and how to use sticky bit on linux shell.

Hope this helps

Lubos