0

I have been creating a user with command adduser, but it did not create directory /home/usertes,

# adduser usertes

And this happens if I delete the user with command userdel:

# userdel usertes
userdel: user usertes is currently logged in

Not logging on to the server, I login with root.

How do I create the directory in /home and, if logging in as usertes, the current directory will be /home/usertes?

As it is now, if I login, I go to directory /.

3
  • What is your Ubuntu version? How do you login to root?
    – Takkat
    Apr 5, 2013 at 6:43
  • login with root via ssh. $ ssh root@server-location Apr 8, 2013 at 8:06
  • 'usertes' is listed as logged in, is someone connected on that username?
    – Thomas Ward
    Jul 22, 2013 at 18:12

1 Answer 1

3

I've never used adduser because it's never worked the way I needed it to when I create a user. However, useradd does work for my needs, but by default won't create the user directory, and isn't as friendly to use.

useradd --create-home USERNAME will create the home directory using default specifications for areas, namely /home/USERNAME

If you want a slightly more verbose version of user-add which I find to be most useful: useradd --create-home --user-group --shell /bin/bash USERNAME will create the home directory, also create a group that matches the user's name (it's how USER:USER can be seen in home directory ownership on new installs where USER is the username).

After you do either of those steps, you'll need to set a password: passwd USERNAME (as superuser or root, to set a password, even if its temporary)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .