Output from mkpasswd/mkgroup ... Again confused (2)

Houder houder@xs4all.nl
Thu Nov 27 17:54:00 GMT 2014

> On Nov 27 17:12, Houder wrote:
>> Hi Corinna,
>> For comparison: output of 'mkpasswd -l' with and without /etc/nsswitch.conf present. Without it, my machine
>> is NOT a 'foreign machine'. When it is present, my machine is a 'foreign machine'. Strikes me as ...
>> Until now, I believed that the output of mkpasswd/mkgroup had no dependency on /etc/nsswitch.conf.
> The most recent version has.  Here's what happens.  If you call mkpasswd
> without parameter, it just calls Cygwin's internal enumeration functions.
> If you call with -l, it checks if `passwd:' is set to "files" only in
> /etc/nsswitch.conf.  If so, it uses the old enumeration functions inside
> mkpasswd, which don't generate prefixed usernames for local accounts
> even on AD machines.  However, the uids/gids differ when using this
> method.  I could change the offset in this case to reduce the chance for
> a difference, but hey, there's no good reason to use /etc/passwd at all
> in your scenario :}

... ahem, you keep saying that (no need for /etc/passwd) to me :-)) However, my (personal) bin
directory has a script called mkpasswd_r(edacted) ... that modifies the uid of some of my users
(yes, me, and a few aliases for me).

And I am sure, that I am not the only one with a script like that ...

Above you are explaining _implementation_ ... not specification.

64-@@ uname -a
CYGWIN_NT-6.1 Seven 1.7.33-2(0.280/5/3) 2014-11-13 15:47 x86_64 Cygwin # ATTENTION: NOT the test release
64-@@ mkpasswd | grep Henri
64-@@ mkpasswd -l | grep Henri

As you will observe, in the 'old days', mkpasswd -l defaulted to 'mkpasswd'.

As it does for the test release, in case one removes /etc/nsswitch.conf.

@@ mkpasswd | grep Henri
@@ mkpasswd -l | grep Henri

(in fact 'mkpasswd -l <my machine>' now shows the same output as the above commands do)

However, in case "nsswitch.conf" specifies passwd: files

    mkpasswd and mkpasswd -l are NOT equal anymore # as result of the _implementation_

This change in behaviour is not apparent from 'mkpasswd --help' ... and it is not documented anywhere.

Yes, I know, that you modified the _implementation_ in response to a request by Christian Franke, and
I do not object against change, but change should not confuse ... I believe.

Bottom-line: the kludge you introduced in mkpasswd (at the request of C.) backfired (well, it did to me).



Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list