Linux permissions

1 minute read

Linux permissions

Each file has three modes of access:
    the owner
    the group
    all others
The following are the chmod octal notations:
    0: Using 0, no read, write, or execute permissions are allowed
    1: It means execute permission only
    2: It means write permission only
    4: It means read permission only
    3: It means the combination of execute and write permissions
    5: It means the combination of execute and read comments only
    6: It means a combination of write permissions and read permissions only
    7: It means full permission or read, write, and execute permissions
When applying permissions to directories on Linux, the permission bits have different meanings than on regular files.

The read bit (r) allows the affected user to list the files within the directory
The write bit (w) allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes
The execute bit (x) allows the affected user to enter the directory, and access files and directories inside
The sticky bit (T, or t if the execute bit is set for others) states that files and directories within that directory may only be deleted or renamed by their owner (or root)
Commands:
    chown and chmod

    The chown (change ownership) command is used to change a file's user and group ownership.
    The chmod (change mode) command controls file permissions for the owner, group, and all other users who are neither 
    the owner nor part of the group associated with the file.