010-160 Users and Group Management 3 — Questions and Answers
Question 1: Which file defines default settings (like UMASK and EXPIRE) applied when creating new users?
- /etc/passwd
- /etc/useradd.conf
- /etc/default/useradd (Correct answer)
- /etc/skel/profile
Correct answer: /etc/default/useradd
/etc/default/useradd stores default values used by the useradd command, such as the default shell and home base directory.
Question 2: What is the purpose of the /etc/skel directory?
- It stores skeleton scripts for system services
- It contains template files copied to a new user's home directory (Correct answer)
- It holds backup copies of /etc/passwd
- It defines the default PATH for all users
Correct answer: It contains template files copied to a new user's home directory
Files in /etc/skel are automatically copied into the home directory of any newly created user.
Question 3: How would you add an existing user 'alice' to an existing group 'developers'?
- groupadd developers alice
- usermod -aG developers alice (Correct answer)
- usermod -G developers alice
- addgroup alice developers
Correct answer: usermod -aG developers alice
usermod -aG appends the group to alice's supplementary groups without removing existing ones; omitting -a would replace all groups.
Question 4: What UID is typically assigned to the root user on a Linux system?
- 0 (Correct answer)
- 1
- 100
- 65534
Correct answer: 0
The root user always has UID 0, which grants superuser privileges on a Linux system.
Question 5: Which command displays all groups a user belongs to?
- groups username
- cat /etc/group | grep username
- id -G username
- Both A and C are correct (Correct answer)
Correct answer: Both A and C are correct
Both 'groups username' and 'id -G username' (without -n flag) display the groups a user belongs to.
Question 6: What does a UID range of 1-999 (or 1-500 on older systems) typically represent?
- Regular user accounts
- System/service accounts (Correct answer)
- Temporary guest accounts
- Shared network accounts
Correct answer: System/service accounts
Low UIDs (1-999) are reserved for system and service accounts like daemon, bin, and www-data.
Question 7: Which command changes the primary group of user 'bob' to 'marketing'?
- usermod -G marketing bob
- usermod -g marketing bob (Correct answer)
- groupmod -u bob marketing
- chgrp marketing bob
Correct answer: usermod -g marketing bob
usermod -g (lowercase) changes the primary group, while -G (uppercase) modifies supplementary groups.
Which file defines default settings (like UMASK and EXPIRE) applied when creating new users?