chown command is used to change the file Owner or group.
chown [OPTION]… [OWNER][:[GROUP]] FILE… To change the owner as well as group: chown nginx:www-data nginx.conf To Change group ownership chown :nginx nginx.conf To change the owner as well as group chown nginx:nginx nginx.conf
- Read: This permission allows the user to read files and in directories, it lets the user read directories and subdirectories stores in it.
- Write: This permission allows a user to modify and delete a file. Also it allows a user to modify its contents (create, delete and rename files in it) for the directories. Unless the execute permission is not given to directories changes does do affect them.
- Execute: This permission on a file allows it to get executed. For example, if we have a file named php.sh so unless we don’t give it execute permission it won’t run.
Types of file Permissions:
- User: These type of file permission affect the owner of the file.
- Group: These type of file permission affect the group which owns the file. Instead of the group permissions, the user permissions will apply if the owner user is in this group.
- Other: These type of file permission affect all other users on the system.
chown www-data:www-data -R /var/www/html/
sudo chown www-data:www-data -R /var/www/html/southjobs.in
To view the permissions we use:
ls -l