LSN #2 Understanding umask

umask (user file creation mask) is a setting in Linux to control default file permissions for newly created files and directories.

By default a file in Linux is created 666 permissions (read, write, but no execute) & directories are created with 777 permissions ( read, write and execute).

umask subtracts the values from the default permissions, so for example if your umask is set to 022 and your file permission is 666, it will result in a permission value of 644. (666 - 022 = 644).

You can type umask to display the current set value & then something like umask 027 to change the set umask. 022 is the most common default umask setting.

To permanently change your umask setting, youll need to edit your .bashrc or bash profile.

An interesting tid bit that I never have thought of before is that directories need execute permissions for someone to 'cd' into them. Without execute, you cant enter the directory itself.