>_ IzzyLab

Hands-on task

This task is step 7 of the course “New server: setup from scratch”

umask 027 for the whole server

medium~5 min

On this server the team's files must not be visible to outside users, but colleagues in the group should be able to read them. Set umask 027 for all new login sessions of all users: new files — 640, new directories — 750. It's checked with a bash login shell (as with bash -l).

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

Topic breakdown

umask doesn't grant permissions, it removes them: a new file starts from 666, a directory from 777, and the mask bits are subtracted from that. The 027 mask takes nothing from the owner, removes write from the group and everything from others — giving 640 for files and 750 for directories. For the rule to apply to all users, it goes not into personal dotfiles but into the system-wide /etc/profile.d/ directory: the login shell sources every *.sh from there at the start of each session.

What's checked

  1. umask in a login shell is 027
  2. a new file gets permissions 640
  3. a new directory gets permissions 750

What it looks like