As we know umask value controls which permission are set for files and directories when they are created.
By default root has umask value of 022 and all ordinary users has umask value of 002.
So for ordinary user file permission would be 664 and directory permission would be 775 and for root users it would be 644 and 744 respectively.
So we know the default permission of files and directories when are created which can be restored using the following commands.
find . -type d \! -user root -print -exec chmod 775 {} \; - for all files owned by ordinary users excluding root
find . -type f \! -user root -print -exec chmod 644 {} \; - for all directory owned by ordinary users excluding root
find . -type f -user root -print -exec chmod 644 {} \; - For all files owned by root
find . -type d -user root -print -exec chmod 744 {} \; - For all directory owned by root
If you have any user which has different umask value other than the defualt one then change the command accordingly. The above procedure is used to restore the permission only to default value.
By default root has umask value of 022 and all ordinary users has umask value of 002.
So for ordinary user file permission would be 664 and directory permission would be 775 and for root users it would be 644 and 744 respectively.
So we know the default permission of files and directories when are created which can be restored using the following commands.
find . -type d \! -user root -print -exec chmod 775 {} \; - for all files owned by ordinary users excluding root
find . -type f \! -user root -print -exec chmod 644 {} \; - for all directory owned by ordinary users excluding root
find . -type f -user root -print -exec chmod 644 {} \; - For all files owned by root
find . -type d -user root -print -exec chmod 744 {} \; - For all directory owned by root
If you have any user which has different umask value other than the defualt one then change the command accordingly. The above procedure is used to restore the permission only to default value.
No comments:
Post a Comment