To change the permissions of an existing directory or file later, you can use the chmod command. This command allows you to modify the read, write, and execute permissions for the owner, group, and others.
Basic Syntax
chmod [options] permissions directory_name
Example Usage
- Using Numeric Permissions: You can specify permissions using numeric (octal) values. For example, to change the permissions of a directory to
755:
chmod 755 my_directory
-
Using Symbolic Permissions: You can also use symbolic notation to add or remove permissions. For example:
- To add execute permission for the group:
chmod g+x my_directory- To remove write permission for others:
chmod o-w my_directory
Permissions Breakdown
r: Read permissionw: Write permissionx: Execute permission
Summary
Using the chmod command, you can easily change the permissions of directories and files at any time, allowing you to manage access control as needed.
