Linux Users & Sudo Permissions – Full Quiz
← Back to Users & Sudo Permissions
← Back to Linux Commands
← Back to Quiz Home
This quiz contains 20 questions focused on Linux user management and sudo permissions.
It helps DevOps engineers understand access control on production systems.
Which command is used to switch to the root user?
sudo su allows an authorized user to escalate privileges and switch to the root shell.
Which command switches to another user without loading their environment?
su username switches to the specified user but retains the environment variables of the original user.
Which command switches to another user and loads their environment?
su - username creates a new login shell, loading the target user's environment variables and home directory.
Which file stores user account information?
The /etc/passwd file contains essential user account information, such as username, UID, GID, home directory, and shell.
Which file stores encrypted user passwords?
The /etc/shadow file stores secure, encrypted password information and account expiration details.
Which command is used to create a new user?
useradd is the low-level utility for creating a new user account on Linux systems.
By default, what does useradd NOT create?
On many systems, useradd does not create a home directory by default unless the -m option is specified or configured otherwise in /etc/login.defs.
Which option with useradd creates a home directory?
The -m flag ensures that the user's home directory is created during account creation.
Which command is used to set or change a user password?
The passwd command allows you to change your own password or, if root, another user's password.
Which command shows user ID and group ID details?
The id command displays user identity information, including UID, GID, and group memberships.
Which group provides sudo access on CentOS / RHEL?
In RHEL-based systems (CentOS, Fedora), the wheel group is typically used to grant sudo privileges.
Which group provides sudo access on Ubuntu?
In Debian-based systems (Ubuntu), the sudo group is dedicated to granting administrative rights.
Which command adds a user to a group?
usermod -aG groupname username appends (add) the user to the specified group without removing them from other groups.
Which command verifies group membership of a user?
Running id username lists all the groups that the specified user belongs to.
Which command removes a user from a group?
gpasswd -d is specifically used to delete a user from a group.
Which command deletes a user account but keeps home directory?
userdel username removes the user account but preserves the home directory and mail spool unless -r is used.
Which command deletes a user account and home directory?
The -r (remove) option with userdel ensures that the user's home directory and mail spool are also deleted.
Which command allows editing system files with root privileges?
Prefixing the command with sudo executes it with root privileges, which is necessary for editing system configuration files.
Which file defines sudo permissions?
The /etc/sudoers file controls which users can run what commands as which users (and machines).
Which command should be used to safely edit the sudoers file?
visudo locks the sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks for syntax errors.
Quiz Progress
0 / 0 questions answered
(0% )
0 correct
Quiz Complete!
0%
Reset quiz
📩 Get weekly DevOps quizzes & guides
📬 Weekly DevOps, Cloud & Gen AI quizzes & guides