Here are some more examples of chmod commands in Linux using both symbolic notation and numeric notation:
Symbolic
Notation:
- Add Permissions:
- Add execute permission for the
owner:
bashCopy code
chmod u+x file
- Add read and execute permissions
for the group:
bashCopy code
chmod g+rx file
- Add write permission for others:
bashCopy code
chmod o+w file
- Remove Permissions:
- Remove write permission for the
owner:
bashCopy code
chmod u-w file
- Remove read and execute permissions
for the group:
bashCopy code
chmod g-rx file
- Remove all permissions for others:
bashCopy code
chmod o= file
- Set Permissions Explicitly:
- Set read and execute permissions
for the owner, and no permissions for the group and others:
bashCopy code
chmod
u=rx,g=,o= file
- Set read and write permissions for
the owner, read permissions for the group, and execute permissions for
others:
bashCopy code
chmod
u=rw,g=r,o=x file
Numeric Notation:
- Add Permissions:
- Add read and write permissions for
the owner:
bashCopy code
chmod u+w file
- Add execute permission for the
group and others:
bashCopy code
chmod go+x file
- Add read, write, and execute
permissions for everyone:
bashCopy code
chmod a+rwx
file
- Remove Permissions:
- Remove write permission for the
owner:
bashCopy code
chmod u-w file
- Remove read and execute permissions
for the group:
bashCopy code
chmod g-rx file
- Remove all permissions for others:
bashCopy code
chmod o= file
- Set Permissions Explicitly:
- Set read and execute permissions
for the owner, and no permissions for the group and others:
bashCopy code
chmod 500 file
- Set read and write permissions for
the owner, read permissions for the group, and execute permissions for
others:
bashCopy code
chmod 764 file
These examples
demonstrate different ways you can use the chmod command to modify file
permissions on Linux. Adjust the commands based on your specific requirements.
No comments:
Post a Comment