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

Peter Vrabec pvrabec at redhat.com
Mon Mar 5 10:08:35 UTC 2012


Hi Nicolas,

it might look that I'm quite hesitant regarding this issue. And it's true. :)

I'm sending a patch that change useradd behavior so it creates base dirs when 
need. The patch is based on implementation in pwdutils.

On Tuesday, February 07, 2012 04:51:38 PM Peter Vrabec wrote:
> 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
> 
> +1
> 
> > 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.

This is actually not true. FreeBSD and Suse creates these non-existing 
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.

I did not put info to stdout/syslog. Feel free to add that message. :)

> > 
> > Any other opinions?
> > 
> > Best Regards,
> 
> Peter.


Peter.

> 
> _______________________________________________
> Pkg-shadow-devel mailing list
> Pkg-shadow-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-shadow-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shadow-utils-upstream-basedir.patch
Type: text/x-patch
Size: 5148 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/attachments/20120305/68f5e4ae/attachment.bin>


More information about the Pkg-shadow-devel mailing list