Lion Cipher Lab
Understand the umask and default file permissions
- Foundations
- Beginner
- ~25 min
- Free · no account required
Why it matters
Every file you create on Linux is born with a set of permissions you never typed — and the umask is the quiet rule that decided them. Get it wrong and a config file full of secrets lands world-readable, or a shared-group folder silently blocks your teammates. This is one of the first things a defender checks on a hardened host and one of the first things an attacker checks on a sloppy one, so understanding it turns "permissions are mysterious" into "I can predict and control exactly who can read my files."
What you'll learn
- Reading permission bits with `ls -l` and `stat -c '%a'`
- Predicting a new file's or directory's mode from the umask
- Setting and resetting the umask for a shell session
- Understanding the base-permission rule (666 for files, 777 for directories)
- Knowing the limits of umask (existing files, per-session scope, setuid/setgid)
Steps in this lab
- What the umask is, in one breath
- Open a plain Linux shell
- See your current umask and create a baseline file
- Tighten the mask to 077 and watch files lock down
- Loosen it to 002 for a shared-group workflow
- Honest limit #1: the umask never touches files that already exist
- Honest limit #2: per-session scope, and the program still gets a say
- What you just proved — and why it matters