cheat.sheets:umask
# umask
# Display or set file mode mask
# Unless configured otherwise, this will set the umask ("user mask" or "file
# mode creation mask") for only the current user, and only his or her current
# session. The (one) leading zero is optional, unless you otherwise need it.
#
# This umask setting is actually recommended for security by major Linux distributions
# like RHEL, Debian and Arch Linux.
#
# The result of '0077' being -- and I'll use standard octal with which we're
# all probably familiar -- that all new files are created using the '600'
# permissions, and directories are '700'.
#
# Remember, the standard format means 4=read, 2=write, and 1=execute.
# However, the umask uses the same, but is inverted, so a umask of '077' would
# be 700, and correctly lowers to 600 when it's just a file.
umask 0077
# Akin to above, but instead, output the current umask setting.
umask
tldr:umask
# umask
# Manage the read/write/execute permissions that are masked out (i.e. restricted) for newly created files by the user.
# More information: <https://manned.org/umask>.
# Display the current mask in octal notation:
umask
# Display the current mask in symbolic (human-readable) mode:
umask -S
# Change the mask symbolically to allow read permission for all users (the rest of the mask bits are unchanged):
umask a+r
# Set the mask (using octal) to restrict no permissions for the file's owner, and restrict all permissions for everyone else:
umask 077
$
cheat.sh