Set umask to 002 in a collaborative shell and create a directory with mkdir.
What mode is normally created?
Directories start from 777; masking 002 removes other's write bit and produces 775.
Detailed explanation
755Incorrect. 755 would also remove group write, which umask 002 does not mask.
775Correct. 0777 with umask 0002 produces 0775.
664Incorrect. 664 is a regular-file-style mode.
002Incorrect. The umask itself is not the resulting directory mode.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); (umask 002; mkdir "$tmp/team"); stat -c '%a' "$tmp/team"; rm -rf "$tmp"Expected result
775Key points
- Directory base mode is 777
- umask 002
- Group write remains
Notes
- Environment: POSIX shell / GNU stat
- Use a disposable file or directory when checking chmod calculations.
- Exact permission display can vary slightly with filesystem and distribution defaults.
Foundation review
Place the operation
Directory creation normally starts from 777, so its execute bits remain unless the mask removes them.
Check the side effect
Do not apply the regular-file base mode when calculating a new directory's permissions.