Skip to main content

linux permission

# chown

``chown user directory``

> chown ali /var/www/html/project/index.php
> chown ali /var/www/html/project

- this will assign user of the target directory or file to ali.

``chown -R user directory``

- this will assign user of target directory and all its child to ali. 

``chown :group directory``

> chown :wheel /var/www/html/project

- this will assign group of target directory to wheel
- difference between user and group is :

``chown user:group directory``

> chown ali:wheel /var/www/html/project

- this will assign user of target directory to ali and group of target directory to wheel

``chown -R --from=root nginx /var/www/html/project``

- change target directory and its child that have current user as root to nginx


``chown -R --from=:root :wheel /var/www/html/project``

- change target directory and its child that have current group as root to wheel