usermod Essentials
Also see Linux Users and Linux Groups
- Add User to a Group
- Change Home Directory
- Change User Name
- Lock Out User
- Set Password Expiration
- Related
- Links
Add User to a Group
sudo usermod -aG group1,group2,group3 username
Check Group Membership
groups username
Change Home Directory
Do not run this command as the user that owns the home folder login as root or an other user with root privileges. You will need to logout and back in for it to take effect.
sudo usermod -d /home/temphome username
Create a new home directory
sudo usermod -d /home/temphome --move-home username
Create a new home directory and move the old files into it
Change User Name
usermod -l newusername oldusername
Lock Out User
usermod -L username
Set Password Expiration
usermod -e username 2022-09-13
Check Password Policy
chage -l username
Related
- Linux Users
- Linux Groups
- /etc/ssh/sshd_config Essentials
- YAML Essentials
- How to Create a Command Alias in Linux
- Find Command in Linux
- Linux IP Essentials
- Linux Routing Essentials
- Enable IP Forwarding in Linux
- Compress and Extract Files Using the tar Command on Linux