QA
Beginner LevelLinux Commands & SysAdmin

What is umask and how does it determine default file permissions?

❓ Interview Prompt: Explain umask (user file-creation mask), default base permissions (666 files / 777 directories), subtraction math, and setting umask.

'umask' (User Mask) specifies permission bits automatically turned OFF (subtracted) when creating new files and directories:

Base Permissions:

•
Default Directory Base: 777 ('rwxrwxrwx')
•
Default File Base: 666 ('rw-rw-rw-')

Math Calculation:

With a umask of '022':

•
New Directory: 777 - 022 = 755 ('rwxr-xr-x')
•
New File: 666 - 022 = 644 ('rw-r--r--')

Code Implementation Example

bash
# Display current umask setting
umask
# Output: 0022

# Set restrictive umask for secure shell session
umask 077
# New files will be created with 600 (rw-------) permissions!
💡Inspecting and setting default file creation permission umask.
🎯 Interview Key Takeaway

umask subtracts permission bits from default 666 (files) and 777 (directories) base creation modes.

#umask#Permissions#Security#Beginner
Back to all Linux Commands & SysAdmin Questions→

More Linux Commands & SysAdmin Interview Questions

Beginner LevelLinux Commands & SysAdmin

How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?

Beginner LevelLinux Commands & SysAdmin

What is the Linux Filesystem Hierarchy Standard (/bin, /etc, /var, /usr, /opt, /tmp)?

Beginner LevelLinux Commands & SysAdmin

What are File Descriptors (0=stdin, 1=stdout, 2=stderr) and Redirection (>, >>, 2>&1)?