Let’s say you want to add a new local user to your Ubuntu 10.04 Lucid Lynx system. You can of course use the graphical tools to do this, but in Linux it’s always best to do know how to do things from the command line.
So here’s how to add a new user to a Ubuntu system from the command line. Let’s assume you want to add a user with a full name of Caina Amalas (the name, of course, of the character from my Sword & Sorceress stories). Use the useradd command at the prompt (note that to add users, you need root-level permissions, so use this command with sudo):
sudo useradd -c “Caina Amalas” -m -s “/bin/bash” camalas
What do all those switches do, exactly?
First, the -c “Caina Amalas” switch lets you specify the user’s full name.
The -m switch creates a home directory for the new user in the /home folder.
The -s “/bin/bash” command specifies that the new user receive a default shell of bash. Otherwise, Ubuntu defaults to the sh shell.
Finally, the command specifies a new username of “camalas” for Caina Amalas.
One last thing, though. Caina will not be able to log into the system until you create a password for her. Which you can do with this command:
sudo passwd camalas
Select a password. Once you have a password, Caina can log into the system using the username camalas and the password you created.