[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian-specific behavior: 'useradd -m' ?



Quoting Matt England <mengland@mengland.net>:

(I realize this may be a faq, but this 'useradd -m' is hard to google...)

Summary:

Is there a more-portable way to add users to a system then useradd(8)?
Why does Debian's useradd(8) require a "-m" switch when other unix/linux
systems that I have seen do not?


Details:

On non-Debian systems:

$ useradd myname

...creates an a login named "myname" with a home directory of /home/myname
(or whatever pathname format the system conf/template files specify).

On at least some flavor of Debian systems (I tested with Debian3.1-based
derivations), the home directory is *not* created unless one uses the "-m"
switch as in:

$ useradd -m myname

Whenever I go add users now to systems, I first check to see if said system
is a Debian one, then I make the choice above.  I'm not sure what "-m" does
on non-Debian systems, if anything.

-Matt

I just tried it on my Suse workstation (it's at school, I don't have a choice) and doing `useradd test` creates the user "test" and makes an entry in /etc/passwd, however it does not create the home directory. Using the -m flag results in the home directory being created. From the Suse man page:

       -m, --create-home
              Create home directory for new user account.

Personally, however, I prefer the adduser and deluser utilities.

-Roberto

--
Roberto C. Sanchez
http://familiasanchez.net/~roberto



Reply to: