Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

Created a new user in Ubuntu 11.04 using

useradd -d /home/dummy -m dummy

Now, after this I set its password using passwd dummy

But, when i login to that user using su - dummy

I get to see No home directory, logging in with HOME=/

cat /etc/passwd | grep dummy shows dummy:x:1001:1001::/home/dummy:/bin/bash

I manually created dir to resolve this issue through mkdir /home/dummy

Now, the error seems to resolve, but I am amazed as to why no files like bash_profile are created in that home directory

share|improve this question
What is the question? – Patrick Apr 15 '12 at 14:56
Do you have anything in /etc/skel? – manatwork Apr 15 '12 at 14:57
@manatwork having anything in /etc/skel wont matter if he created the directory with mkdir. /etc/skel is only used when something like useradd creates it. – Patrick Apr 15 '12 at 15:05
What is the output of useradd -D – fpmurphy1 Apr 15 '12 at 16:34
-m means the home directory should have been created and populated from /etc/skel. What happens if you create another user? Check what useradd is doing. Are you seeing any message? If you can't find anything, post the output of strace useradd -d /home/test1 -m test1. – Gilles Apr 16 '12 at 0:47

You forgot a parameter:

-m, --create-home             create the dummy's home directory

Are you sure you set the correct owner and permission to the directory?

$ ls -ld /home dummy
drwx------ dummy dummy ........... dummy

$ chown dummy:dummy /home/dummy
$ chmod 700 /home/dummy

If you've already files in the directory, add an extra -R to both commands.

share|improve this answer
-m is present in the command, look closely. – Mat Apr 15 '12 at 15:41
I stand corrected. – jippie Apr 15 '12 at 15:44
-m is shown in the question, but then OP still had to run mkdir? I think some information is missing. Maybe there was an error. Or maybe OP ran useradd without -m the first time. – Mikel Apr 15 '12 at 16:22

To avoid such mistakes, you should use the perl script "adduser" that comes with ubuntu. It is a wrapper around useradd that helps you to perform the operation in a wizard style ->[source]...

share|improve this answer
Adduser is fine if you want to interactively create users. Does not work for non-interactively creating users, – fpmurphy1 Apr 15 '12 at 16:33

In /etc/login.defs, change the system wide setting CREATE_HOME and set it to yes.

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.