Explore the critical commands, concepts, and best practices for managing users and groups in Linux environments. Strengthen your skills in account creation, permissions, group management, and user administration with this targeted quiz.
What command should an administrator use to create a new user account named 'jordan' with default settings in a Linux terminal?
Explanation: The 'useradd jordan' command creates a new user named 'jordan' with default configurations in most Linux environments. 'mkuser jordan' is not a standard tool for adding user accounts. 'usermod jordan' is intended for modifying an existing user, not creating one. 'addusergroup jordan' is not a valid command and combines elements of unrelated commands.
If you want to change the primary group of an existing user 'alex' to 'developers', which command should you use?
Explanation: The 'usermod -g developers alex' command correctly changes 'alex's primary group to 'developers'. 'groupmod' is used for modifying group properties but not for assigning users. 'useradd -g developers alex' would attempt to create a new user, not modify an existing one. 'passwd -g developers alex' is not a valid way to set user group information.
Which command would display all groups that the user 'sam' belongs to on a Linux system?
Explanation: 'groups sam' displays all the groups associated with the user 'sam' in Linux. 'showgroup sam' and 'groupinfo sam' are not recognized commands for viewing user group memberships. 'listgroups sam' may sound correct but does not exist in standard Linux distributions.
Which one of the following best describes the primary use of the /etc/passwd file in Linux user management?
Explanation: The /etc/passwd file stores basic user details such as usernames, user IDs, group IDs, home directories, and default shells. It does not house encrypted passwords, which are generally found in /etc/shadow. Log files, not /etc/passwd, record login attempts and errors. The management of group definitions and memberships is primarily handled by the /etc/group file.
You want to add the user 'rowan' to the existing 'sudo' group without removing them from other groups. Which command accomplishes this?
Explanation: 'usermod -aG sudo rowan' adds 'rowan' to the 'sudo' group and preserves other group memberships due to the '-aG' flags. 'useradd -g sudo rowan' would attempt to create a new user with 'sudo' as primary group, which is not the goal. 'groupadd sudo rowan' is incorrect as it tries to create a group. 'passmod -a sudo rowan' is a malformed command and not valid for group management.