Reco wrote: > Tom H wrote: > > I'm not an adduser user so that's why I checked the manpage for "-d". > > > > If your assumption that useradd short options should be understood > > adduser, isn't this a bug?
I don't think there is an expectation of cross compatibility of options between those two commands. AFAIK adduser is Debian specific and useradd came from other distros. AFAIK Debian supports useradd as a nod to those other distros. And because IIRC the LSB requires it. Because the user account system isn't magical and being well behaved it is okay if the useradd command is used. It won't break anything. It allows a project to share a postinst script between packaging for Debian and packaging for other systems which only have useradd. But again AFAIK in Debian the adduser command is the preferred of the two. But not so far as to say it is a bug if it isn't used. > I don't know. But the behaviour of adduser and useradd is consistent in > this regard: > > # userdel test > # useradd -d /var/a/b/c test > Creating mailbox file: File exists > useradd: cannot create directory /var/a/b/c > # userdel test > # adduser -d /var/a/b/c test > Creating mailbox file: File exists > adduser: cannot create directory /var/a/b/c > > If that's a bug, it's sure a longstanding one - I've reproduced it on > RHEL5 (which has userland from 2006). Those do seem consistent. So I think your guess that it is in adduser for compatibility with useradd is likely correct. Just the same the adduser -d case would be invalid if it weren't a documented use case. And in either case I wouldn't expect either command to make intervening directories. But they don't need to. /var/lib is required to exist and therefore the postinst script won't have any trouble using either command to create the user's home directory. Bob
signature.asc
Description: Digital signature