This is the first part in a series on LInux Basics. Today, I’m going to give you a brief run-down on creating user accounts and creating groups from the linux command line. These aren’t difficult tasks, but often times it’s good to refresh the basics and have a reference to go back to. So, here we go.
How to add a user account
Creating a user account is a very straight forward process and nearly identical for all Linux distributions.
# useradd username
Some distributions, such as Ubuntu, might have the root account disabled. If so, you will need to use sudo to gain root privileges to run a specific command. If you get a permission denied error, simply run this command instead.
# sudo useradd username
How to set or change a password
Once you’ve created a user account, you will need to set a password. To do so, use the passwd command.
# passwd username Enter new UNIX password: Retype new UNIX password: or # sudo passwd username Enter new UNIX password: Retype new UNIX password: