0

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.

closed as unclear what you're asking by slm Jul 6 '18 at 14:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 Apr 16 '12 at 0:47
5

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.

  • 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
1

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

-1

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

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