Users and Groups Flashcards
Objective 2.2: Given a scenario, implement identity management (47 cards)
Which of the following best describes the root account in Linux?
π Options
A. A non-human background account used for services
B. A regular user account with limited access
C. The most powerful account with full system access
D. An account used only for SSH login
β
Correct Answer
C. The most powerful account with full system access
π‘ Explanation
A. β This is a service account, not the root account.
B. β A standard user, not root.
C. β Correct β root can read, write, delete any file, and change system-wide settings.
D. β Any user may be used for SSH β this isnβt exclusive to root.
What is the purpose of the βsudoersβ file?
π Options
A. To store service logs for user accounts
B. To define which users have administrative privileges
C. To manage login attempts and failures
D. To monitor background services
β
Correct Answer
B. To define which users have administrative privileges
π‘ Explanation
A. β Service logs are handled by syslog, journald, etc.
B. β Correct β the /etc/sudoers file controls sudo access.
C. β Thatβs handled by log tools like faillog, not sudoers.
D. β Background services are monitored by systemd or service tools.
What makes visudo safer than editing /etc/sudoers directly?
π Options
A. It opens in a hidden mode that canβt be seen by others
B. It encrypts the sudoers file
C. It checks for syntax errors and prevents lockout
D. It runs the file in a container
β
Correct Answer
C. It checks for syntax errors and prevents lockout
π‘ Explanation
A. β Visudo isnβt hidden β itβs about safe editing.
B. β No encryption is involved.
C. β Correct β it checks syntax before saving to avoid locking you out of sudo.
D. β Thereβs no container use β itβs just a safer editor wrapper.
Which statement about sudoedit is true?
π Options
A. It runs your editor as root, just like sudo nano
B. It lets you edit files with elevated privileges safely
C. It only works on .conf files
D. It replaces the sudoers file entirely
β
Correct Answer
B. It lets you edit files with elevated privileges safely
π‘ Explanation
A. β sudoedit runs the editor as your user, not root.
B. β Correct β it safely lets you edit, and uses sudo only to save changes.
C. β It can edit any file, not just .conf.
D. β It does not replace files, just edits them.
What is the βwheelβ group used for in Linux?
π Options
A. To restrict access to graphical applications
B. To limit SSH login attempts
C. To allow group members to use sudo
D. To monitor user activities
β
Correct Answer
C. To allow group members to use sudo
π‘ Explanation
A. β Not related to GUI access.
B. β SSH login policies are managed elsewhere.
C. β Correct β members of the wheel group can use sudo when allowed in /etc/sudoers.
D. β Activity monitoring is done by audit or logging tools.
How does polkit differ from sudo?
π Options
A. polkit is used for command-line actions only
B. sudo is used for background processes
C. polkit checks GUI-based policy rules instead of sudoers
D. sudo requires no password while polkit does
β
Correct Answer
C. polkit checks GUI-based policy rules instead of sudoers
π‘ Explanation
A. β polkit is mostly for GUI/background actions.
B. β sudo is used by the user on CLI, not by background processes.
C. β Correct β polkit uses its own rules separate from /etc/sudoers.
D. β Both may require passwords depending on system config.
What is the purpose of the pkexec command?
π Options
A. To check file permissions
B. To reboot the system
C. To run commands as another user using Polkit
D. To open a shell as root using sudo
β
Correct Answer
C. To run commands as another user using Polkit
π‘ Explanation
A. β Use ls -l or stat to check file permissions.
B. β Use reboot or shutdown, not pkexec.
C. β Correct β pkexec uses Polkit to elevate permissions like sudo.
D. β sudo -i opens a root shell β not pkexec.
What does the command /sbin/shutdown -h now do in Linux?
π Options
A. It creates a new shutdown configuration file
B. It halts (shuts down) the system immediately
C. It displays system uptime
D. It restarts the system
β
Correct Answer
B. It halts (shuts down) the system immediately
π‘ Explanation
A. β No configuration file is created.
B. β Correct β -h means halt, and now means immediately.
C. β Use uptime or w for that.
D. β To restart, youβd use reboot, not shutdown -h.
Why do most commands in /sbin/ require sudo or root privileges?
π Options
A. They are not executable by any user
B. They handle non-critical background tasks
C. They can affect system-wide settings or stability
D. They only work inside user home directories
β
Correct Answer
C. They can affect system-wide settings or stability
π‘ Explanation
A. β They are executable but restricted to privileged users.
B. β They handle critical tasks, not background ones.
C. β Correct β commands like shutdown, fsck, and iptables need elevated privileges.
D. β These commands are system-wide, not limited to home directories.
Which of the following commands typically resides in /sbin/ and requires sudo?
π Options
A. ls
B. reboot
C. nano
D. cat
β
Correct Answer
B. reboot
π‘ Explanation
A. β ls is in /bin or /usr/bin, used by regular users.
B. β Correct β reboot is a system-level command and requires sudo.
C. β nano is a text editor, generally doesnβt need sudo.
D. β cat is used to read file contents and is user-level.
What does which shutdown return on most Linux systems?
π Options
A. The shutdown history of the system
B. A man page with shutdown instructions
C. The full path to the shutdown binary
D. A configuration script for shutdown
β
Correct Answer
C. The full path to the shutdown binary
π‘ Explanation
A. β last or journalctl would show shutdown history.
B. β man shutdown would show documentation.
C. β Correct β which shows where the command is stored (usually /sbin/shutdown).
D. β Thereβs no script output; itβs a binary location.
Which command is used to check and repair file systems in Linux and typically lives in /sbin/?
π Options
A. mount
B. fsck
C. lsblk
D. findmnt
β
Correct Answer
B. fsck
π‘ Explanation
A. β mount mounts file systems, not repairs them.
B. β Correct β fsck (file system check) is a repair tool and requires sudo.
C. β lsblk lists block devices, not for repair.
D. β findmnt shows mounted filesystems but doesnβt repair.
Where are most user-level commands like ls, cp, mv, and curl stored?
π Options
A. /sbin
B. /etc
C. /usr/bin
D. /boot
β
Correct Answer
C. /usr/bin
π‘ Explanation
A. β /sbin is for administrative tools.
B. β /etc stores config files, not binaries.
C. β Correct β /usr/bin holds standard user-level commands.
D. β /boot contains bootloader files and kernels.
Which /usr/bin command requires sudo only when modifying files owned by another user?
π Options
A. mv
B. chown
C. cat
D. echo
β
Correct Answer
B. chown
π‘ Explanation
A. β mv usually doesnβt require sudo unless youβre writing to protected areas.
B. β Correct β chown (change ownership) requires elevated permissions for files you donβt own.
C. β cat is a read-only command.
D. β echo prints to screen or files you have write access to.
Which /usr/bin command may require sudo if stopping a process you donβt own?
π Options
A. top
B. kill
C. ps
D. uptime
β
Correct Answer
B. kill
π‘ Explanation
A. β top is just for viewing.
B. β Correct β kill can only stop your own processes unless you use sudo.
C. β ps is for viewing processes.
D. β uptime shows how long the system has been running.
What does the useradd -D command do in Linux?
π Options
A. Deletes a default user account
B. Displays or sets default user creation values
C. Deletes all user passwords
D. Displays disk usage for each user
β
Correct Answer
B. Displays or sets default user creation values
π‘ Explanation
A. β The -D flag doesnβt delete users.
B. β Correct β useradd -D shows or modifies the system-wide defaults for new users (e.g., shell, home path).
C. β Passwords are managed with passwd or chage.
D. β Use du or quota for disk usage info.
What is the purpose of the SKEL field in useradd -D defaults?
π Options
A. Stores user email settings
B. Specifies shell encryption method
C. Defines which default files are copied into new user home directories
D. Controls the shell version used by users
β
Correct Answer
C. Defines which default files are copied into new user home directories
π‘ Explanation
A. β Not related to email.
B. β Encryption methods are defined elsewhere, like in /etc/login.defs.
C. β Correct β /etc/skel contains default config files (e.g., .bashrc) that are copied to new usersβ home folders.
D. β The shell is defined with the SHELL field.
If the default shell is set using sudo useradd -D -s /bin/zsh, what will happen?
π Options
A. All existing users will be switched to Zsh
B. All future users will have /bin/zsh as their login shell
C. The Zsh package will be installed automatically
D. No changes will occur until /etc/shadow is edited
β
Correct Answer
B. All future users will have /bin/zsh as their login shell
π‘ Explanation
A. β Only new users are affected, not existing ones.
B. β Correct β this sets Zsh as the default shell for users created after this change.
C. β Shell packages must be installed manually.
D. β /etc/shadow controls password settings, not shell.
Why is it unsafe to manually edit /etc/passwd?
π Options
A. It causes file permissions to change
B. It may corrupt system logs
C. It can break user records and affect login ability
D. It deletes the user if you make a typo
β
Correct Answer
C. It can break user records and affect login ability
π‘ Explanation
A. β Permissions are not auto-altered by editing.
B. β Not directly related to logs.
C. β Correct β manual edits can introduce syntax errors that prevent users from logging in.
D. β Typos may break things but wonβt auto-delete accounts.
Why were password hashes moved from /etc/passwd to /etc/shadow?
π Options
A. To reduce disk usage
B. To allow users to see their own passwords
C. Because /etc/passwd is world-readable
D. To speed up the boot process
β
Correct Answer
C. Because /etc/passwd is world-readable
π‘ Explanation
A. β File size wasnβt the issue.
B. β Showing passwords is a security flaw.
C. β Correct β since any user can read /etc/passwd, password hashes were moved to /etc/shadow, which is restricted.
D. β This change wasnβt about boot speed.
Which file stores hashed user passwords and password expiration info in modern Linux systems?
π Options
A. /etc/group
B. /etc/passwd
C. /etc/skel
D. /etc/shadow
β
Correct Answer
D. /etc/shadow
π‘ Explanation
A. β /etc/group stores group memberships.
B. β No longer stores hashed passwords.
C. β /etc/skel contains default files for new user home directories.
D. β Correct β /etc/shadow securely stores password hashes and expiration info.
What does the -D option do in the useradd command?
π Options
A. Deletes a user account
B. Disables password login
C. Views or sets default user creation settings
D. Displays disk usage
β
Correct Answer
C. Views or sets default user creation settings
π‘ Explanation
A. β Use userdel to delete users.
B. β passwd -l locks login, not useradd -D.
C. β Correct β useradd -D controls system-wide defaults like shell and home base.
D. β Use du for disk usage.
What happens if INACTIVE=-1 is set in useradd -D?
π Options
A. Password never expires
B. Account is disabled immediately after password expiration
C. Account is never disabled, even after password expires
D. Account is locked after 1 day
β
Correct Answer
C. Account is never disabled, even after password expires
π‘ Explanation
A. β Expiry and inactivity are different.
B. β That would be a 0, not -1.
C. β Correct β -1 means no auto-disable after password expiry.
D. β Not a valid setting here.
What does the -m flag in useradd -m username do?
π Options
A. Changes the userβs password
B. Creates a mail account
C. Creates a home directory and copies default files
D. Makes the user a system admin
β
Correct Answer
C. Creates a home directory and copies default files
π‘ Explanation
A. β Passwords are set using passwd.
B. β Mail creation is separate.
C. β Correct β -m sets up /home/username with contents from /etc/skel.
D. β Admin privileges require group/sudoer configuration.