useradd doesn't create /home/user_name directory

Bug #603283 reported by Ioannis Vranos
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
shadow (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I tested the bug under Ubuntu 9.10 x64 Server and 10.04 x64 Desktop.

The command:

useradd -c "First name, Last name" [-d /home/user_name] user_name

doesn't create the directory /home/user_name, so when the user user_name logs in the console, he is presented with the error message:

No directory, logging in with HOME=/

Tested with Fedora 13 x64, and it works OK there.

ProblemType: Bug
Architecture: amd64
Date: Thu Jul 8 21:17:14 2010
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: nvidia
Package: passwd 1:4.1.4.1-1ubuntu2
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-22.60-generic
SourcePackage: shadow
Uname: Linux 2.6.31-22-generic x86_64

Revision history for this message
Ioannis Vranos (cppdeveloper) wrote :
Revision history for this message
David Sugar (dyfet-deactivatedaccount) wrote :

Thank you for this report. I can understand there are differences in distros sometimes. The default configuration for Debian is to not create the home directory. You have to explicitly use the -m option to do so.

Curiously, the question of whether to automatically create the home directory is not part of the defaults (/etc/defaults/useradd) as far as I can see.

Also, the -d option by itself is not quite what it seems. I note this from the changelog:

    - debian/patches/459_better_document_useradd_-d
      Better document, in useradd.8, that the home_dir specified
      with -d is not created if it does not exist
      Closes: #154996

And:

   - useradd requires the -m option to make it create a home directory
      if one does not exist, closes: #39581

So this specific behavior was decided upon in Debian. It is possible, for different reasons, Fedora chose a different default behavior in this respect.

In any case, I think the package maintainer should now have enough info to understand if this needs to be changed, better documented, or left alone.

Revision history for this message
Ioannis Vranos (cppdeveloper) wrote : Re: [Bug 603283] Re: useradd doesn't create /home/user_name directory

On Fri, 2010-07-16 at 20:03 +0000, David Sugar wrote:
> Thank you for this report. I can understand there are differences in
> distros sometimes. The default configuration for Debian is to not
> create the home directory. You have to explicitly use the -m option to
> do so.
>
> Curiously, the question of whether to automatically create the home
> directory is not part of the defaults (/etc/defaults/useradd) as far as
> I can see.
>
> Also, the -d option by itself is not quite what it seems. I note this
> from the changelog:
>
> - debian/patches/459_better_document_useradd_-d
> Better document, in useradd.8, that the home_dir specified
> with -d is not created if it does not exist
> Closes: #154996
>
> And:
>
> - useradd requires the -m option to make it create a home directory
> if one does not exist, closes: #39581
>
> So this specific behavior was decided upon in Debian. It is possible,
> for different reasons, Fedora chose a different default behavior in this
> respect.
>
> In any case, I think the package maintainer should now have enough info
> to understand if this needs to be changed, better documented, or left
> alone.

Thank you for your reply.

Essentially you mean that the default behaviour of useradd under Ubuntu
is the -M option, while in Fedora it is the -m option.

I am currently reading a Linux book and I considered it a bug.

Another thing which I find bothersome, is the fact that the default
shell assigned by useradd is /bin/sh instead of /bin/bash, while under
X.Org, Ubuntu's Users management assigns /bin/bash by default to new
users. I consider this as an inconsistency.

In summary, I think that useradd should create the home directory as the
default behaviour, and provide the same default shell as its GUI
counterparts for consistency.

Regards,

--
Ioannis Vranos

C95 / C++03 Software Developer

http://www.cpp-software.net

Revision history for this message
Ioannis Vranos (cppdeveloper) wrote :

Also Ubuntu's GUI Users management also creates the home directory by default, so I think this is also an inconsistency between useradd and its GUI counterparts.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in shadow (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.