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

Nicolas François nicolas.francois at centraliens.net
Thu Feb 2 20:52:01 UTC 2012

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
i.e. the above command should create /non-existing/foo if /non-existing

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. 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