Bug#302630: [Pkg-shadow-devel] Bug#302630: useradd not creating home directories

Nicolas François Nicolas François , 302630@bugs.debian.org
Sat, 2 Apr 2005 05:20:37 +0200


severity 302630 minor
merge 154996 302630
thanks

Hi,

On Fri, Apr 01, 2005 at 07:45:33PM -0500, Jiann-Ming Su wrote:
> useradd does not create home directories or groups.  I have found this
> to be the case on i386, alpha, and mips.
> 
> o2:~# useradd -c "Some User" suser
> o2:~# ls -al /home/
> total 8
> drwxrwsr-x   2 root staff 4096 2004-12-15 18:27 .
> drwxr-xr-x  21 root root  4096 2005-03-31 20:55 ..

You should use the -m flag to create home directories.

This is documented in the man page:
   The new user account will be entered into the system files as needed,
   the home directory will be created, and initial files copied, depending
   on the command line options.
and:
   -m  The user’s home directory will be created if it does not exist.

> o2:~# cat /etc/group | grep suser

useradd does not add groups.  It only add users.  You can set the initial
group with the -g flag, but you need to create this group before (with
groupadd).

You may want to use adduser to add a new user with her home directory and
her initial group.


Given that you're not the only one who failed to create a home directory,
I'm wondering if the following sentence should not be added in the manual
page:

    By default, useradd does not create the user's home directory.


We can also add to the -d option:

    You can use the -m flag to force the creation of the directory if it
    does not exist.


Note: the man page update should also include a fix for Bug#150587.

Best Regards,
-- 
Nekral