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→