Wednesday, 24 April 2013

Sticky bit- Only user of the file or the directory owner or root user can delete files in directory

Suppose if you want that any user can create files in the directory but no user can delete files created by any other user , then set sticky bit permission on the directory.

Syntax: 
$ chmod +t dir_name

now if you check permission on directory , you would see an extra 't' permission on the directory.

$ ls -ld dir_name
drwxrwxrwt 3 dir_owner dir_owner_group 4096 Nov 21 12:35 dir_name

Now , any user can create files in this directory but no user can delete files of other users from this directory except dir_owner and root user

No comments:

Post a Comment