Creating a new user on GNU/Linux
July 9th 2020 | ~ 1 minute read
Creating a new user doesn't have to be a terribly difficult endeavor. In this tutorial we'll see how we can do it in just a few simple steps.
We will be using the useradd command to accomplish this. You can find additional information about this command by reading a manual page in your terminal.
man useradd
Creating a user is actually dead simple, just run:
sudo useradd -m -s /bin/bash desired_username
The -m option creates a home directory for the new user in /home/desired_username
The -s option sets the default shell, in this case bash.
Now we need to set a password for the newly created user, to that end we'll use the passwd command. Type the following and follow the prompt on a screen to do so:
sudo passwd desired_username
And with that you've completed this tutorial. I hope you've learned something useful.