potential error with adduser

David Henderson dhenderson at digital-pipe.com
Thu Dec 15 13:53:09 UTC 2016


Thanks for the reply Sam!

On 12/15/16, Sam Liddicott <sam at liddicott.com> wrote:
> You are allowed to have inaccurate information in /etc/passwd.

Obviously :)

> For instance, there is nothing to check that the information in the GECOS
> field [https://en.wikipedia.org/wiki/Gecos_field] is correct.

For sure, but this is also a comment, not something as important as a
home directory specification.  Most don't even use that field at all
(at least in my experience).  And also, the default isn't to add
something like "this is a robot" for the value of this field using
'adduser'.  Whatever you specify is the value that is inserted.  If I
use the -H parameter, I would expect to not have a value for the home
directory since I elected not to create one.

> There is nothing to stop you deleting the created home directory
> afterwards, and nothing to force you to update the password file if you do
> delete it afterwards.
>
> I think you want the user to have an empty home directory field; that might
> be specified with: -h ""
>
> Maybe that is what you are asking for?
>
> Sam

I was more or less surprised by the fact that the default method was
to put false information in the passwd file and was clarifying if this
was appropriate.  As I've stated numerous times, I can't see a
circumstance where this would be advised.

Dave


> On 14 December 2016 at 20:59, David Henderson <dhenderson at digital-pipe.com>
> wrote:
>
>> Hey Tito, thanks again for the reply.  I'm not sure how that example
>> is disproving my concerns. :)  It is still reflecting inaccurate
>> information in /etc/passwd.
>>
>> Dave
>>
>>
>> On 12/14/16, Tito <farmatito at tiscali.it> wrote:
>> >
>> >
>> > On 12/14/2016 03:26 PM, David Henderson wrote:
>> >> Thanks for the reply Tito!  No problem about the initial response - it
>> >> happens. :)  To me it would seem little odd to state something in one
>> >> place, but not have it in reality.  Would there be a reason to have
>> >> this mismatch of information?  It has an appearance of just being
>> >> messy and providing misinformation.
>> >>
>> >> Thanks,
>> >> Dave
>> >
>> > Hi,
>> > take as example this line from /etc/passwd
>> >
>> > nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
>> >
>> > this is an user that you would create with using -H:
>> >
>> > adduser -u 65534 -G nobody -h /nonexistant -H -D -s /usr/sbin/nologin
>> >
>> > Ciao,
>> > Tito
>> >
>> >>
>> >> On 12/14/16, Tito <farmatito at tiscali.it> wrote:
>> >>>
>> >>>
>> >>> On 12/14/2016 07:59 AM, Tito wrote:
>> >>>> On 12/13/2016 04:46 PM, David Henderson wrote:
>> >>>>> Good morning gang!  Working with the 'adduser' applet and noticed
>> that
>> >>>>> when specifying the '-H' parameter the /etc/passwd file still gets
>> >>>>> a
>> >>>>> home directory value (which doesn't exist in the file system).  Is
>> >>>>> this an error?  If no home directory was to be made, shouldn't that
>> >>>>> value be blank?
>> >>>>>
>> >>>>> Thanks,
>> >>>>> Dave
>> >>>>
>> >>>> Hi,
>> >>>> from man adduser on debian:
>> >>>> "adduser will create a home directory subject to DHOME, GROUPHOMES,
>> and
>> >>>> LETTERHOMES.  The home directory can be overridden from the command
>> >>>> line
>> >>>> with the --home option"
>> >>>> In fact we don't support DHOME, GROUPHOMES, and LETTERHOMES but
>> >>>> use only the user name to create the home directory unless
>> >>>> the name is specified on the command line with the -H option.
>> >>>>
>> >>>>     /* create string for $HOME if not specified already */
>> >>>>         pw.pw_dir = xasprintf("/home/%s", argv[0]);
>> >>>>
>> >>>> We don't support  --no-create-home option at the moment
>> >>>> but i think it would be easy to add.
>> >>>>
>> >>>> Ciao,
>> >>>> Tito
>> >>>
>> >>> Sorry, I misunderstood your question and was in a rush.
>> >>> So let's try to be more accurate this time.
>> >>> In reality we support the -H option as you correctly
>> >>> stated:
>> >>>
>> >>> -H  same as --no-create-home
>> >>> -h alternative name for home dir rather than user's name
>> >>>
>> >>> but -H --no-create-home refers only to the creation of the
>> >>> home dir (the mkdir) not to having it in /etc/passwd:
>> >>>
>> >>> "Do not create the home directory, even if it doesn't exist"
>> >>>
>> >>> so i think busybox is doing it correctly.
>> >>>
>> >>> Sorry for the previous noise.
>> >>>
>> >>> Ciao,
>> >>> Tito
>> >>>
>> >>> _______________________________________________
>> >>> busybox mailing list
>> >>> busybox at busybox.net
>> >>> http://lists.busybox.net/mailman/listinfo/busybox
>> >>>
>> >>
>> > _______________________________________________
>> > busybox mailing list
>> > busybox at busybox.net
>> > http://lists.busybox.net/mailman/listinfo/busybox
>> >
>> _______________________________________________
>> busybox mailing list
>> busybox at busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
>>
>


More information about the busybox mailing list