LINUX: useradd & usermod : The Linux User Administration

LINUX: useradd & usermod : The Linux User Administration

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!