I created a user without home directory using useradd -M Alice and set a password. Now when I login, I get this message

No directory /home/Alice! Logging in with home= "/"

Can anyone explain the meaning of last line and solve this issue?

  • Well since there is no /home directory set for Alice, you may want to go into /etc/passwd and add a directory for that user.. – ryekayo May 27 '16 at 15:53

I think you can solve it like that:

mkdir /home/Alice

chown -R Alice:Alice /home/Alice

Even better if you use adduser instead of useradd, the directory will create automatically.


The -M flag for useradd means "do not create the user's home directory", so the program has done what you asked.

You can fix the problem by creating a home directory for Alice and copying in the template files:

home=$(getent passwd Alice | cut -d: -f6)
uid=$(getent passwd Alice | cut -d: -f3)
gid=$(getent passwd Alice | cut -d: -f4)
mkdir -m755 "$home"
cp -a /etc/skel/. "$home"
chown -R $uid:$gid "$home"

Logging in with home= "/" means what it says. Since there is no home directory for the user, the login has used the root directory "/"

The -bash-4.1$ is the default bash prompt. You see that when there is no ~/.bashrc nor other default bash files. These are normally created, stored and updated in the user's home directory.

Using "/" as the home directory will cause other problems, as the user Alice most likely does not have permissions to write to the root directory of the filesystem. :-)

As roaima and Luciano Andress Martini wrote, you can fix this issue by creating a home directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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