-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux usermod Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to usermod on Linux, covering Arch Linux, CachyOS, and other distributions including modifying users, changing user properties, and user account management.
usermod modifies existing user accounts.
Uses:
- Change properties: Modify user settings
- Add groups: Add user to groups
- Change shell: Update default shell
- Lock/unlock: Disable/enable accounts
Why it matters:
- User management: Update user accounts
- Permissions: Modify user access
- Configuration: Change user settings
Update shell:
# Change user shell
sudo usermod -s /bin/zsh username
# Change to fish
sudo usermod -s /usr/bin/fish usernameMove home:
# Change home directory
sudo usermod -d /new/home/username -m username
# -m moves filesUpdate user ID:
# Change UID
sudo usermod -u 1001 username
# Update file ownership
sudo find /home/username -user old-uid -exec chown username {} \;Update group:
# Change primary group
sudo usermod -g groupname username
# Or by GID
sudo usermod -g 1001 usernameAdd groups:
# Add to group (append)
sudo usermod -aG groupname username
# Add to multiple groups
sudo usermod -aG group1,group2 usernameReplace groups:
# Set groups (replaces)
sudo usermod -G group1,group2 username
# Note: -G replaces, -aG appendsCheck user:
# Verify user exists
id username
# Check current groups
groups username
# Check home directory
ls -la /home/usernameThis guide covered usermod usage, user modification, and account management for Arch Linux, CachyOS, and other distributions.
- useradd Guide - User creation
- User and Groups - User management
- groupadd Guide - Group management
-
usermod Documentation:
man usermod
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.