How to change permissions later?

To change permissions of a file or directory later in Linux, you can use the chmod command. Here’s how to do it:

Using chmod

  1. Numeric Method: You can specify permissions using numeric (octal) values.

    chmod 755 filename

    This sets the permissions to rwxr-xr-x.

  2. Symbolic Method: You can also use symbolic notation to add or remove permissions.

    • Add permissions: Use +
    • Remove permissions: Use -
    • Set exact permissions: Use =

    Examples:

    • To add execute permission for the owner:
      chmod u+x filename
    • To remove write permission for the group:
      chmod g-w filename
    • To set permissions to read and write for the owner only:
      chmod u=rw,go= filename

Summary

The chmod command is flexible and allows you to change permissions either numerically or symbolically. If you have more questions or need examples, feel free to ask!

0 Comments

no data
Be the first to share your comment!