Challenge - 5 Problems
Group Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of the command to list all groups on the system?
You run the command
cat /etc/group on a Linux system. What will this command output?Linux CLI
cat /etc/group
Attempts:
2 left
💡 Hint
Think about where Linux stores group information.
✗ Incorrect
The file /etc/group contains all groups on the system along with their group ID and member users.
💻 Command Output
intermediate1:30remaining
What does the command
groups username output?You run
groups alice on a Linux system. What output should you expect?Linux CLI
groups alice
Attempts:
2 left
💡 Hint
This command shows group memberships for a specific user.
✗ Incorrect
The
groups username command lists all groups that the specified user belongs to.💻 Command Output
advanced2:00remaining
What is the effect of the command
sudo usermod -aG sudo alice?You run
sudo usermod -aG sudo alice. What does this command do?Linux CLI
sudo usermod -aG sudo alice
Attempts:
2 left
💡 Hint
The -a and -G options together modify group membership.
✗ Incorrect
The
-a option appends the user to the supplementary groups listed by -G without removing existing groups.💻 Command Output
advanced2:00remaining
What error occurs when running
sudo usermod -G sudo alice if 'alice' is already in groups 'users' and 'staff'?You run
sudo usermod -G sudo alice but 'alice' was previously in groups 'users' and 'staff'. What happens?Linux CLI
sudo usermod -G sudo alice
Attempts:
2 left
💡 Hint
The -G option without -a replaces group memberships.
✗ Incorrect
Using
-G without -a replaces the user's supplementary groups with the listed ones, removing previous memberships.🚀 Application
expert3:00remaining
Write a script snippet to add a user to multiple groups safely without removing existing groups
You want to add user 'bob' to groups 'docker' and 'video' without removing his current groups. Which script snippet achieves this correctly?
Attempts:
2 left
💡 Hint
The -G option accepts a comma-separated list, but appending multiple times requires separate commands.
✗ Incorrect
Option C runs a single command appending both groups at once, ensuring no existing groups are removed. Option C runs two commands appending each group separately, which also works. Option C replaces groups. Option C is invalid syntax.