Using chmod command we can change the permissions of files and directories.
We can use symbolic code plus (+) to add permissions and use minus (–) to remove permissions. Therefore, to give read permission we use +r. In addition, we use +w to give write permission and +x to give execute permission. For removing these permissions, we use -r to remove read permission, -w to remove write permission and -x to remove execute permission.
Sometimes, we need to change the permissions of a directory and all its subfolders and files. In these cases, we use -R option to recursively apply permission to all subfolders and files:
chmod -R <permissions> <directory>
chmod 755:
755 means read and execute access for everyone and also write access for the owner of the file. When you perform chmod 755 filename command you allow everyone to read and execute the file, the owner is allowed to write to the file as well.
To change all the directories to 755 (drwxr-xr-x):
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
chmod 644:
Permissions of 644 mean that the owner of the file has read and write access, while the group members and other users on the system only have read access.
To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
Comments (0)