How Do I Create an Ubuntu User with a Home Directory?

On an Ubuntu server, you might encounter a problem when it comes time to create a new user manually. Running the “useradd” command will create a user but do nothing else. It will not ask you to create a password or create a home directory. There are two easy solutions for this:

1. Run useradd with these parameters:

sudo useradd -d /home/username -m username

This will tell it to create a directory for the user at /home/username. You will then need to set a password (because having a password for a user is optional):

sudo passwd username

2. Alternatively, you could use the program “adduser”, which has a similar name but a much more simplified approach. Simply type:

adduser username

It will ask you for a password and a few other questions about the user.

sudo adduser username


Adding user `username’…

Adding new group `username’ (1004).

Adding new user `username’ (1004) with group `username’.

Creating home directory `/home/username’.

Copying files from `/etc/skel’

Enter new UNIX password:

Retype new UNIX password:

No password supplied

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

Changing the user information for username

Enter the new value, or press ENTER for the default

Full Name []: User Name

Room Number []: 0

Work Phone []: 555-4712

Home Phone []: 555-1048

Other []:

Is the information correct? [y/N] y

You should now have a working user account with home directory on your Ubuntu server.