CompTIA Linux+ (XK0-006)Services and User ManagementHard
A system administrator is auditing user accounts and finds that the default `umask` for a new service user `svcuser` is `0002`. If `svcuser` creates a new directory named `appdata`, what will be the octal permissions of this directory?
- A765
- B755
- C777
- D775
Show answer & explanationAnswer & explanation
Correct answer: D. 775
For directories, the base permissions are typically `777` (rwxrwxrwx). The `umask` value is subtracted from these base permissions. For `umask 0002`: `777 - 002 = 775`. This means the owner and group have full permissions (rwx), while others have read and execute permissions (r-x), but no write permission.
Why the other options are wrong
- A. `765` is an unlikely result from a standard umask and base permission calculation, indicating an error in calculation.
- B. `755` would be a `umask` of `0022` (777-022 = 755), which is not `0002`.
- C. `777` would be a `umask` of `0000`, which is not `0002`.
Umask Calculation for Directories
The `umask` (user file-creation mode mask) determines the default permissions for newly created files and directories.
- For directories, base permissions are usually `777` (rwxrwxrwx).
- The `umask` bits are 'subtracted' from the base permissions (more accurately, the inverse of the umask is ANDed with the base permissions).
- The first digit of umask (often 0) usually represents special permissions, not affecting base rwx.
Memory trick: UMASK: Subtract from 777 (dirs) or 666 (files), then check the math!