0

when I create a new user in Ubuntu Server and then try to login with the new user I get an error message.

In one case Ubuntu tells me that the home directory of the user doesn't exist when I login and Ubuntu then shows me a dollar shell. In the other case, when I create a home folder for the user, Ubuntu just shows me a dollar shell when I log in with the user.

I use: useradd NAME. I thought the home directory was automatically created when creating a user.

Can anyone help me?

3
  • Regarding the $-prompt: what did you expect to see? That prompt is normal for the server version (since no desktop).
    – Rinzwind
    Jan 19, 2013 at 20:46
  • That question has been answered yesterday: sudo useradd -d /home/user -m user is the correct commnand ;)
    – Rinzwind
    Jan 21, 2013 at 15:47
  • problem solved. thx for the help. Forgot something. Stupid. :)
    – user122025
    Jan 21, 2013 at 16:02

2 Answers 2

3

The command to have useradd create a home is

sudo useradd -d /home/user -m user

Where user (2 times) is your account name.

(The files in the new home directory are copied from the /etc/skel folder)

1
  • 1
    I tried the command you gave, but I still have the same problem. Creating the user is ok, but the problem begins after logging in with the created user. I just get the $-prompt. Normally it should be user@ubuntu:~$, what I see is just:$
    – user122025
    Jan 21, 2013 at 15:48
1

You can create a home directory by adding the -d flag.

  -d, --home HOME_DIR
           The new user will be created using HOME_DIR as the value for the
           user's login directory. The default is to append the LOGIN name to
           BASE_DIR and use that as the login directory name. The directory
           HOME_DIR does not have to exist but will not be created if it is
           missing.

The $ in the terminal indicates that you are not using the bash shell, where you are familiar with I guess. When creating a home dir I guess the problem is over. Otherwise you can switch change to bash with which bash.

You must log in to answer this question.