Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to understand system administration on Ubuntu. So, as an example, I create a dummy user using

sudo useradd -d /home/linda linda

and passwd to create the password. I check that an entry has been made using cat /etc/passwd


However, when I su - linda, I get

No directory, logging in with HOME=/

and indeed, no home directory has been created. What am I missing?


share|improve this question
up vote 42 down vote accepted

man useradd states:

useradd is a low level utility for adding users. On Debian,
administrators should usually use adduser(8) instead.

Note the low level utility

To add a user, use adduser instead. It's a more high-level utility.

Moreover, looking at the -d option:

   -d, --home HOME_DIR
       The new user will be created using HOME_DIR as the value for the
       user's login directory. The default is to append the LOGIN name to
       BASE_DIR and use that as the login directory name. The directory
       HOME_DIR does not have to exist but will not be created if it is

The directory will not be created if it is missing.

Generally keep away from useradd, use adduser instead.

share|improve this answer
In the OP's defense, when I read "On Debian,", I thought it meant on Debian as opposed to Ubuntu distros. I am aware that Ubuntu is built on Debian but thought that a distinction was being made. – Keith Bennett May 15 '15 at 16:11
I used adduser but still the created home directory only contains a file examples.desktop and nothing else. How can I get Ubuntu to create the default folders Desktop, Downloads and so on? (I'm logged in via ssh) – mcExchange Aug 13 '15 at 11:35

you can fix this simply by creating the home dir.

mkdir /home/linda
chown linda:linda /home/linda

try logging in again and this should work.

share|improve this answer

Look at /etc/defaults/useradd if you want to change the defaults. Use:

useradd -m -d /home/joe -s /bin/bash.

share|improve this answer

According with man useradd, -d /home/linda option will not create the directory /home/linda, if this is missing. So, you have to create it manually. To do this, run the followings commands in terminal:

sudo -i                            #to get root privileges
mkdir /home/linda                  #to create the directory /home/linda
cp -rT /etc/skel /home/linda         #to populate /home/linda with default files and folders
chown -R linda:linda /home/linda   #to change the owner of /home/linda to user linda

See also: How to make user home folder after account creation?

share|improve this answer
+1 for mentioning /etc/skel – Joe Nov 14 '13 at 2:11

You can also modify /etc/pam.d/common-session to make it so that a user's home directory will be created on first log in. Add the following line to that file.

session required

This is particularly useful if your system is on a network where the users are managed externally to your machine, by LDAP for instance.

share|improve this answer
Good advice, thanks. – tchakravarty Nov 13 '13 at 22:17

Add the below entry in /etc/login.defs and save:


Now, try to create user accounts. It will create the home directory.

share|improve this answer
It worked for me. I needed to have a basic script that will remotely add/manage users on different flavors of Linux. After this change my code produces same results on all servers. Thanks. – saidakkas Feb 18 at 2:36

Use adduser.


 adduser  and  addgroup  add users and groups to the system according to
   command    line    options    and    configuration    information    in
   /etc/adduser.conf.   They  are  friendlier  front ends to the low level
   tools like useradd, groupadd and usermod programs, by default  choosing
   Debian  policy conformant UID and GID values, creating a home directory
   with skeletal configuration, running a custom script,  and  other  fea‐
   tures.  adduser and addgroup can be run in one of five modes:

useradd you have to add all options yourself. Including permissions and some other things.adduser does this based on sane defaults (and also adds home dir by itself).

If you need to use adduser you probably need the -b option together with the -d option!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.