The
chmod
command can be used to modify the file mode of files and directories.
The
chmod
command can also be used to modify the Access Control Lists (ACLs) associated with files and directories:
chmod -- change file ACLs (Access Control Lists).
Files (and directories) have the ownership set for a user, group, or others.
Each of them can define three regular types of permissions: read (r), write (w), and execute (x).
The dash (-) character is used when a permission is not set.
A file (or directory) permissions are set using 9 bits (
rwxrwxrwx
)
that define the read, write, and execute permissions for the user, group, and others.
The first 3 bits defines the read, write, and execute permissions for the user,
the next three bits for the group,
and the last three bits for others.
By default permissions of a new created file (or directory) is set using the value of
umask
(default
002
).
To set the permission of the new created file (or directory),
the value of umask
002
is combined with the default permissions of a file which is
666
(or directory
777
).
So by default a new created file has the permissions
rw-rw-r--
(
664
)
and new created directory has the permissions
rwxrwxr-x
(
775
).