- The default creation permissions can be modified using the
umask
utility. - By default, on Linux systems, the default creation permissions are
666
for files, which gives read and write permission to user, group, and others, and to777
for directories, which means read, write and execute permission to user, group, and others. - Linux does not allow a file to be created with execute permissions.
Command to view the current mask value
umask umask -S
- As we have already mentioned, the default creation permissions for files are
666
and for directories777
. - To calculate the permission bits of the new files subtract the umask value from the default value.
- For example, to calculate how
uname 022
will affect newly created files and directories, use:- Files:
666 - 022 = 644
. The owner can read and modify the files. Group and others can only read the files. - Directories:
777 - 022 = 755
.The owner can cd into the directory and list read, modify, create or delete the files in the directory. Group and others cancd
into the directory and list and read the files.
- Files: