What is umask and how is the final permission calculated?
IntermediateConceptPermissions, Users & sudo
Answer
umask is a mask of bits removed from the default creation mode (666 for files, 777 for directories). With umask 022: files get 644, directories 755. With 027: files 640, directories 750.
umask # 0022
umask 027
Set it per service with UMask=0027 in a systemd unit, or system-wide in /etc/login.defs / /etc/profile.
More on Permissions, Users & sudo
Explain the rwx permission model for files and directories.BeginnerHow does octal notation work in chmod?BeginnerWhat does chown do and who can run it?IntermediateWhat is SUID and give a real example?IntermediateWhat does SGID do on files versus directories?IntermediateWhat does a capital S or T in `ls -l` output mean?Intermediate