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 the message:

No home directory, logging in with HOME=/

If I check the user account dummy's entry in /etc/passwd:

 $ cat /etc/passwd | grep dummy

I manually created the directory to resolve this issue through mkdir /home/dummy.

Now, the error seems to be resolved, but I'm amazed as to why no files like bash_profile are created in that home directory.

  • 7
    What is the question? – Patrick Apr 15 '12 at 14:56
  • 3
    Do you have anything in /etc/skel? – manatwork Apr 15 '12 at 14:57
  • 3
    @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 – fpmurphy Apr 15 '12 at 16:34
  • 1
    -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 'SO- stop being evil' 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.

| improve this answer | |
  • 2
    -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
  • 1
    -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's a wrapper around useradd that helps you to perform the operation in a wizard style ->[source]...

| improve this answer | |

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

| improve this answer | |

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