Ensure root user umask is configured
Scanned 5/30/2026
Install via CLI
openskills install CyberStrikeus/CyberStrike---
name: cis-ubuntu2004-v300-5-4-2-6
description: "Ensure root user umask is configured"
category: cis-iam
version: "3.0.0"
author: cyberstrike-official
tags: [cis, ubuntu, linux, ubuntu-20.04, users, authentication]
cis_id: "5.4.2.6"
cis_benchmark: "CIS Ubuntu Linux 20.04 LTS Benchmark v3.0.0"
tech_stack: [ubuntu, linux]
cwe_ids: []
chains_with: []
prerequisites: []
severity_boost: {}
---
# 5.4.2.6 Ensure root user umask is configured (Automated)
## Profile
- Level 1 - Server
- Level 1 - Workstation
## Description
The user file-creation mode mask (`umask`) is used to determine the file permission for newly created directories and files. In Linux, the default permissions for any newly created directory is 0777 (`rwxrwxrwx`), and for any newly created file it is 0666 (`rw-rw-rw-`). The `umask` modifies the default Linux permissions by restricting (masking) these permissions. The `umask` is not simply subtracted, but is processed bitwise. Bits set in the `umask` are cleared in the resulting file mode.
`umask` can be set with either `Octal` or `Symbolic` values:
- `Octal` (Numeric) Value - Represented by either three or four digits. ie `umask 0027` or `umask 027`. If a four digit umask is used, the first digit is ignored. The remaining three digits effect the resulting permissions for user, group, and world/other respectively.
- `Symbolic` Value - Represented by a comma separated list for User `u`, group `g`, and world/other `o`. The permissions listed are not masked by `umask`. ie a `umask` set by `umask u=rwx,g=rx,o=` is the `Symbolic` equivalent of the `Octal` umask `027`. This `umask` would set a newly created directory with file mode `drwxr-x---` and a newly created file with file mode `rw-r-----`.
root user Shell Configuration Files:
- `/root/.bash_profile` - Is executed to configure the root users' shell before the initial command prompt. Is only read by login shells.
- `/root/.bashrc` - Is executed for interactive shells. only read by a shell that's both interactive and non-login
`umask` is set by order of precedence. If `umask` is set in multiple locations, this order of precedence will determine the system's default `umask`.
Order of precedence:
1. `/root/.bash_profile`
2. `/root/.bashrc`
3. The system default umask
## Rationale
Setting a secure value for `umask` ensures that users make a conscious choice about their file permissions. A permissive `umask` value could result in directories or files with excessive permissions that can be read and/or written to by unauthorized users.
## Audit Procedure
### Command Line
Run the following to verify the root user `umask` is set to enforce a newly created directories' permissions to be `750` (`drwxr-x---`), and a newly created file's permissions be `640` (`rw-r-----`), or more restrictive:
```bash
# grep -Psi -- '^\h*umask\h+(([0-7][0-7][01][0-7]\b|[0-7][0-7][0-7][0-6]\b)|([0-7][01][0-7]\b|[0-7][0-7][0-6]\b)|(u=[rwx]{1,3},)?((g=[rx]?[rx]?w[rx]?[rx]?\b)(,o=[rwx]{1,3})?|((g=[wrx]{1,3},)?o=[wrx]{1,3}\b)))' /root/.bash_profile /root/.bashrc /etc/login.defs
```
## Expected Result
Nothing should be returned.
## Remediation
### Command Line
Edit `/root/.bash_profile` and `/root/.bashrc` and remove, comment out, or update any line with `umask` to be `0027` or more restrictive.
## Default Value
System default `umask`
## References
1. NIST SP 800-53 Rev. 5: AC-3, MP-2
## CIS Controls
v8 - 3.3 Configure Data Access Control Lists: Configure data access control lists based on a user's need to know. Apply data access control lists, also known as access permissions, to local and remote file systems, databases, and applications. (IG 1, IG 2, IG 3)
v7 - 14.6 Protect Information through Access Control Lists: Protect all information stored on systems with file system, network share, claims, application, or database specific access control lists. These controls will enforce the principle that only authorized individuals should have access to the information based on their need to access the information as a part of their responsibilities. (IG 1, IG 2, IG 3)
MITRE ATT&CK Mappings: T1083 - Tactics: TA0007
No comments yet. Be the first to comment!