QA
Beginner LevelLinux Commands & SysAdmin

How do useradd, usermod, groupadd, and /etc/passwd manage users and groups?

❓ Interview Prompt: Explain user management, useradd, usermod -aG, groupadd, /etc/passwd structure, and /etc/shadow security.

Linux user accounts and permission groups are managed via system utilities and configuration files:

•
'useradd -m deploy': Creates new user with home directory.
•
'usermod -aG sudo deploy': Appends user to 'sudo' administrative group.
•
'/etc/passwd': Stores user metadata (username, UID, GID, home dir, shell).
•
'/etc/shadow': Stores cryptographically hashed user passwords (readable only by root).

Code Implementation Example

bash
# Create new system user with bash shell
sudo useradd -m -s /bin/bash deploy

# Add user to docker and sudo groups
sudo usermod -aG docker,sudo deploy

# Set user password
sudo passwd deploy
💡Creating user accounts and assigning group memberships.
🎯 Interview Key Takeaway

Use usermod -aG to append users to secondary groups without overwriting existing group memberships.

#useradd#usermod#Users#Groups#Beginner
Back to all Linux Commands & SysAdmin Questions→

More Linux Commands & SysAdmin Interview Questions

Beginner LevelLinux Commands & SysAdmin

How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?

Beginner LevelLinux Commands & SysAdmin

What is the Linux Filesystem Hierarchy Standard (/bin, /etc, /var, /usr, /opt, /tmp)?

Beginner LevelLinux Commands & SysAdmin

What are File Descriptors (0=stdin, 1=stdout, 2=stderr) and Redirection (>, >>, 2>&1)?