Welcome to the Linux Foundation Forum!

Possible error in LFS207 slide on useradd

Options

I wasn't sure where to report this, but the slide in LFS207 discussing useradd appears to have a minor error: The slide claims that the basic syntax of sudo useradd example_user implicitly creates the home directory (& populates skel files, etc.), which does not appear to be correct on my test systems. The -m flag seems to be necessary, at least in the Debian 12 and Ubuntu 22.04 systems I've been using.

The example on the slide with arguments contains this flag, and the manpage for useradd seems to reflect this, as well: https://linux.die.net/man/8/useradd

Comments

  • h.krantz
    h.krantz Posts: 2
    Options

    Oh, okay, the video at the end of the section mentions that it varies by distro. The manpage mentions a CREATE_HOME option in /etc/login.defs, but I didn't see that option in my config file. /etc/default/useradd seems to be another candidate, but I also don't see it defined there.

  • luisviveropena
    luisviveropena Posts: 1,159
    Options

    Hi @h.krantz,

    Oh, okay, the video at the end of the section mentions that it varies by distro.

    Yep, I just did a test on Ubuntu 22.04 and it needs the '-m' flag in order to create the user directory (or used the adduser tool instead). But on CentOS 8 Stream it works without the '-m' flag.

    So, it depends on the OS.

    Regards,
    Luis.

Categories

Upcoming Training