Work out umask value instantly with clear inputs, formula shown and shareable results.
umask removes permission bits from a base mode rather than setting them. Files start at 666 and directories at 777 — the execute bit is never granted to new files — and umask bits are cleared from that base. A umask of 022 therefore yields 644 for files and 755 for directories, which is the common default.
umask application
resulting mode = base mode AND NOT umask; base is 666 for files and 777 for directories
Because the base mode for files is 666. Making every new file executable would be dangerous, so execute must be added explicitly with chmod.
002 or 007 with a setgid directory, so group members can write each other's files. 027 or 077 suit private or sensitive data.