Umask Calculator with Effective Permissions Preview
<p>A Linux tool for calculating umask values and previewing their effect on file and directory permissions</p>
Umask Calculator
Umask Permission Bits
Checked boxes represent bits that are BLOCKED in new files/directories.
umask 022
Effective Permissions Preview
File Creation (Default: 666)
Directory Creation (Default: 777)
Common Umask Values
What is umask
?
umask
(user mask) is a command in Linux/Unix systems that sets the default permissions for newly created files and directories. It works by "masking out" (removing) certain permission bits from the default permissions.
How Umask Works
When you create a new file or directory, the system starts with default permissions (typically 666 for files and 777 for directories), then subtracts the umask value:
For Files:
Default file permissions (666) minus your umask value gives the actual permissions for new files
For Directories:
Default directory permissions (777) minus your umask value gives the actual permissions for new directories
Understanding Umask Values
Umask uses the same octal notation as chmod, but with opposite meaning:
- 1 blocks execute (x)
- 2 blocks write (w)
- 4 blocks read (r)
For example, umask 022 means "block write and execute for group and others, but don't block anything for owner".
Checking Current Umask
To check your current umask setting:
0022
The leading 0 is sometimes shown but can be omitted when setting the umask.
Common Umask Settings
Umask | File Permissions | Directory Permissions | Description |
---|---|---|---|
022 | 644 (rw-r--r--) | 755 (rwxr-xr-x) | Default on most Linux systems, good balance of security |
002 | 664 (rw-rw-r--) | 775 (rwxrwxr-x) | Good for collaborative environments where group members need write access |
077 | 600 (rw-------) | 700 (rwx------) | Maximum privacy, files accessible only by the owner |
027 | 640 (rw-r-----) | 750 (rwxr-x---) | Group can read/execute but not write, others have no permissions |
007 | 660 (rw-rw----) | 770 (rwxrwx---) | Owner and group have full access, others have none |
Setting Your Umask
Temporary Change
To set umask for your current session only:
Permanent Change
To make your umask change permanent, add it to your shell's startup file:
For Bash:
umask 022
For Zsh:
umask 022
Tips & Best Practices
- The standard umask on most Linux systems is
022
, which is a good balance between security and usability - For sensitive data, consider using a more restrictive umask like
077
- On shared systems where collaboration is important,
002
might be appropriate - Remember that the umask only affects newly created files, not existing ones
- When setting up web servers, the umask may need to be adjusted based on which user runs the web server process
Related Tools
Account Lock/Unlock Script Generator
Generate Linux user account lock/unlock scripts and commands. Create automated scripts for managing account security, password policies, and user access control with comprehensive logging and notifications.
ACL Permission Generator (getfacl/setfacl)
<p>A Linux tool to generate getfacl and setfacl commands for managing Access Control Lists (ACLs) on files and directories.</p>
Anacron Job Generator (Daily/Weekly/Monthly)
Generate anacron job configurations for daily, weekly, and monthly tasks. Create reliable scheduled jobs that run even when the system is offline, with support for both anacron and systemd timer alternatives.
at Command Generator
Generate precise at commands for Linux task scheduling. Schedule one-time tasks with our interactive command generator tool.
AutoMount Configuration Tool
Configure automatic mounting of filesystems and devices at boot time. Create proper fstab entries, configure udev rules, and set up systemd mount units for seamless filesystem access without manual intervention.
Bind Mount Generator
Generate bind mount configurations for chroot environments, containers, and directory overlays. Create mount commands, fstab entries, and systemd mount units with proper options for various bind mount scenarios.
Stay Updated with Linux Tips
Get weekly tutorials, command references, and new tool announcements delivered straight to your inbox.