Creating New Users on Ubuntu 12.04 from the Shell

Ubuntu Tux

Today I needed to create a few new users on a fresh Ubuntu 12.04 install from the command line. Thankfully, I was in as root, so all I needed were the commands to get these accounts set up and ready to go. For each account I did the following steps - doing them twice for the two accounts isn't all that hard to do.

First, create the user (and make the home directory if not there):

  $ useradd -m drbob

next, change the password on the new account:

  $ passwd drbob

next, change the default login shell for the account: (/bin/bash)

  $ chsh drbob

finally, add the user to the sudo group so this user can, well… sudo:

  $ adduser drbob sudo

At this point, I was able to login, make sure I was there, then tar up my .ssh directory and what I needed from my Ubuntu 12.04 home directory on another box, and put it all on the new server with a simple sep command.

When I logged in next, it was all there and I was ready to go. Sweet!