Skip to main content

Command Palette

Search for a command to run...

LINUX: useradd & usermod : The Linux User Administration

Updated
1 min read
LINUX: useradd & usermod : The Linux User Administration
A

A Tech Lead by profession, a Data Enthusiast and a forever learner. Experienced in DevOps, Cloud, FullStack Development, Data Science, Machine Learning and AI.

Adding user to a Linux environment is pretty easy!
Just type useradd followed by username. Example:

useradd anupam

But!! the user cannot login yet, because the password needs to be set.
The password must follow the suggested password rule. To set password, just type passwd followed by username and enter the new password ( needs to be executed as root or SU privileges). If you are not a SU then you can only change your password with this command.

You can find the password rules, aging rules etc in the file:

/etc/login.defs

To modify existing user use the command usermod. It has a lot of options like modifying primary group, supplementary group, lock and unlock user account, move or update user home directory etc. Example, to lock user account:

usermod -L anupam

And finally to delete a user, use the command userdel

Pretty interesting eh!

More from this blog

A

Anupam Majhi

28 posts

Tech Lead | DevOps, Cloud, FullStack, Data Science, Machine Learning, AI