>_ IzzyLab

Hands-on task

This task is step 5 of the course “Linux server security”

Strict default umask

medium~5 min

Configure the system so that new login sessions have a umask of 077 (new files — owner only). The setting must apply to all users (it's checked with a bash login shell, as with bash -l).

What you'll practise:
  • umask
  • default permissions
  • /etc/profile.d
  • login shell

Topic breakdown

umask doesn't set permissions but subtracts them: the system takes the base 666 for files and clears the mask's bits, so a strict mask leaves access to the owner only. To make the rule apply in all new login sessions and for all users, it's placed not in personal dotfiles but in a system-wide location from which the login shell automatically picks up environment scripts — the /etc/profile.d/ directory. A short .sh file calling umask with the required value is enough there.

What's checked

  1. umask in the login shell equals 077
  2. a new file gets 600 permissions

What it looks like