Tuesday, January 17, 2017

File and Directory Permissions



Change owner and group of a file:

chown   user:group   file/dir               => Will change the owner and group of a file/directory
chown   user   file/dir                         => Will change the owner of the file/directory
chown   :group   file/dir                      => Will change the group of a file/directory



Change permissions:

chmod   ug+X   -R  dir1                       =>  Will set the execute permissions on the directory                                                                                       dir1                                          
                                                                    and only the child directories with in that leaving file                                                                                 permissions as it is.


chmod   ug+x   -R  dir1                       =>  Will set the execute permissions on the directory                                                                                        dir1                                                          
                                                                   and all the child directories.


Sticky Bit:

The passwd command is owned by the user root. Whereas every user can use the command to reset their passwords as the sticky bit is set on the passwd file.










Sticky bit will prevent a regular user from deleting the file.







No comments:

Post a Comment