[Pkg-shadow-devel] user directory in non-existing path

Peter Vrabec pvrabec at redhat.com
Tue Feb 7 15:51:38 UTC 2012

Hi Nicolas,

On Thursday, February 02, 2012 09:52:01 PM Nicolas François wrote:
> Hi Peter,
> On Thu, Feb 02, 2012 at 01:55:01PM +0100, pvrabec at redhat.com wrote:
> > If "useradd -b /non-existing -m foo"  creates a new user and path to
> > user's homedir contains non-existing directories, the command fails.
> > 
> > Is such a behavior OK? I'm not sure. Man page is saying
> Currently useradd creates home directories but does not recursively create
> directories.
> i.e. the above command should create /non-existing/foo if /non-existing
> exists.
> See also in useradd.c:
> 		/* XXX - create missing parent directories.  --marekm */
> I would not really mind changing this behavior. But I do not know neither
> if this would be a good idea.
> The current situation
>  * is a safe guard against typos (e.g. "useradd -b /hoome -m foo" fails
>    instead of creating /hoome)
>    -> on the other hand, superusers are not supposed to make typos, and
>       issues can be fixed later on.
>  * lets the superuser decide on the permission of the parent directories


> I've no strong opinion on this. 

I'm more inclined to making man page clear that non-existing directories are 
not being created.

I have looked at similar tools - libuser, sssd, pw(freeBSD). None of them 
create that directories.

> If needed I can get a patch for this (IIRC
> a patch exists in the openembedded distribution for this).
> It might be a good idea to put diagnostic info to stdout and syslog in
> such case to indicate that directories were created.
> Any other opinions?
> Best Regards,


More information about the Pkg-shadow-devel mailing list