Welcome to the Linux Foundation Forum!

Ch. 33. Creating accounts with useradd.

vam
vam Posts: 6

I run ubuntu 14.04.

This course page notes that 'useradd' creates home directory and adds login shell entry to /etc/passwd, but it doesn't.

And when I invoke 'man useradd' it gives

...
DESCRIPTION
useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.
...

So maybe it is a typo? Does useradd on non-debian systems behave differently?

Comments

  • rchenzheng
    rchenzheng Posts: 36
    edited February 2016
    I believe your machine is right as usually there are distros differences.

    However, I can confirm that useradd does work in Centos 7
  • Hi vam,

    What is the command you are using, please? So I can try it on my side.

    Thanks,
    Luis.
  • Elyas
    Elyas Posts: 28
    I used both Ubuntu 14.04 and 15.04.

    In fact
    useradd user1
    
    only creates a new user named user1, but does not create the home directory from the skeleton. In the man page they say you need to add a param:
    useradd -m user1
    

    Reading the man page was helpful in this case.
  • Well, you were able to solve it, that's good :) As it has been said, there are some few differences between distros.

    Regards,
    Luis.
  • dbuday
    dbuday Posts: 17

    Excuse me for intruding, but instead of opening new topic, let me hook up on this one as this is next step in this Lab.

    Problem:

    After creation on new user, exercise is to try 'ssh user1@localhost', which should fail because there is no password set - and it does.

    So i set password for that user, checked /etc/passwd and /etc/shadow (password is really there) and i then try again 'ssh user1@localhost', which, i presume, should be OK this time, but it returns the same error 'ssh: connect to host localhost port 22; Connection refused'

    It's CentOS 6.

    What's wrong?

    It is all in Solution - restart sshd service - and that's it!

    Sorry. I'll be smarter next time.

  • luisviveropena
    luisviveropena Posts: 1,142

    Hi,

    Yeah, it seems like the service was stopped. Next time please start a new thread.

    Regards,

    Luis.

Categories

Upcoming Training