CompTIA Linux+ (XK0-006)Services and User ManagementMedium

A junior administrator needs to modify the default umask for all newly created users on a Linux server to `0027`. This change should be system-wide and persist across reboots. Which file should the administrator edit?

  1. A/etc/bashrc
  2. B/etc/skel/.bashrc
  3. C/etc/login.defs
  4. D/etc/profile
Show answer & explanation

Correct answer: C. /etc/login.defs

`/etc/login.defs` contains system-wide default settings for user accounts, including the `UMASK` value, which determines the default umask for newly created users.

Why the other options are wrong

  • A. `/etc/bashrc` is sourced for interactive non-login shells. It's not the primary place for system-wide defaults for *new users*.
  • B. `/etc/skel/.bashrc` is copied to a new user's home directory. While a umask can be set there, it would only apply to that specific user's interactive shells and wouldn't be the system-wide default for *new users*.
  • D. `/etc/profile` is sourced for login shells and can set umask, but `/etc/login.defs` is specifically for default values for *newly created users*.

/etc/login.defs

The `/etc/login.defs` file contains system-wide default settings for user account creation and management on Linux, including password policies, UID/GID ranges, and default umask.

  • Influences `useradd` and other user management utilities.
  • Settings are applied when a user account is *created*.
  • Common parameters include `PASS_MAX_DAYS`, `UID_MIN`, `GID_MIN`, and `UMASK`.

Memory trick: Login definitions dictate user beginnings.

More Services and User Management questions