Change File Permissions in CentOS 7 Guide
To change the permissions of a file, you can use the chmod command. Here are the steps to change the permissions:
- Open the terminal window.
- Navigate to the directory where the file you want to change permissions for is located using the cd command.
- Check the current permissions of a file using the “ls” command. For example:
ls -l filename
- Change the file permissions using the chmod command. You can use the following command format:
chmod [权限设置] filename
Among them, the permissions can be set in one of the following forms:
- Numerical form: For example, 777 indicates that all users have read, write, and execute permissions.
- Symbolic form: For example, adding u+r means granting read permission to the file owner.
To set the owner of the file “filename” to read and write, the group users to read-only, and other users to read-only, you can use the following command:
chmod 644 filename
- Use the “ls” command to check the file permissions again, to make sure the changes have taken effect.