To change the permissions of an existing directory, you can use the chmod command. The chmod command allows you to modify the permissions for the owner, group, and others.
Syntax
chmod <permissions> <directory_name>
Example
Using Numeric Mode:
To set the permissions of a directory named
mydirto755, you would use:chmod 755 mydirThis gives the owner read, write, and execute permissions, while the group and others get read and execute permissions.
Using Symbolic Mode:
You can also use symbolic notation to change permissions. For example, to add execute permission for the group on
mydir, you would use:chmod g+x mydirTo remove write permission for others, you would use:
chmod o-w mydir
Checking Permissions
To verify the changes, you can use the ls -ld command:
ls -ld mydir
This will display the current permissions of the directory.
