No home directory, logging in with HOME=/
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]...
Related videos on Youtube
Novice User
Updated on September 18, 2022Comments
-
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 usingsu - 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 about 12 yearsWhat is the question?
-
manatwork about 12 yearsDo you have anything in /etc/skel?
-
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 likeuseradd
creates it. -
fpmurphy about 12 yearsWhat is the output of useradd -D
-
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 whatuseradd
is doing. Are you seeing any message? If you can't find anything, post the output ofstrace useradd -d /home/test1 -m test1
.
-
-
Mat about 12 years
-m
is present in the command, look closely. -
jippie about 12 yearsI stand corrected.
-
Mikel about 12 years
-m
is shown in the question, but then OP still had to runmkdir
? I think some information is missing. Maybe there was an error. Or maybe OP ranuseradd
without-m
the first time.