No home directory, logging in with HOME=/

51,205

Solution 1

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.

Solution 2

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]...

Share:
51,205

Related videos on Youtube

Novice User
Author by

Novice User

Updated on September 18, 2022

Comments

  • Novice User
    Novice User almost 2 years

    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
    dummy:x:1001:1001::/home/dummy:/bin/bash**
    

    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.

    • phemmer
      phemmer about 12 years
      What is the question?
    • manatwork
      manatwork about 12 years
      Do you have anything in /etc/skel?
    • phemmer
      phemmer about 12 years
      @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.
    • fpmurphy
      fpmurphy about 12 years
      What is the output of useradd -D
    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' about 12 years
      -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.
  • Mat
    Mat about 12 years
    -m is present in the command, look closely.
  • jippie
    jippie about 12 years
    I stand corrected.
  • Mikel
    Mikel about 12 years
    -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.