[Adduser-devel] Bug#150186: adduser, deluser screw up /etc/passwd NIS "+::::::" entry

Kevin B. McCarty kmccarty at Princeton.EDU
Thu Nov 17 13:47:03 UTC 2005


Marc Haber wrote:
> On Wed, Mar 24, 2004 at 11:39:05AM +0100, Marc Haber wrote:
> 
>>adduser uses useradd from the passwd package to do the real work.
>>Please verify if the behavior can be reproduced when directly calling
>>the low level tool, and reassign to passwd in this case.

My apologies for taking so long to reply.

First, for reference, I've upgraded my cluster to sarge, so the version
of adduser is now 3.63, and that of passwd is 4.0.3-31sarge5.

As far as I can tell, the problem does appear to be with adduser, not
useradd.  Useradd called by itself does not fuss with the NIS line in
/etc/passwd.  Please see the command session below (this was run on the
NIS master):

maia[42]:~# tail -n 3 /etc/passwd
Debian-exim:x:107:107::/var/spool/exim4:/bin/false
privoxy:x:103:65534::/etc/privoxy:/bin/false
+::::::
maia[43]:~# useradd testuser
maia[44]:~# tail -n 3 /etc/passwd
privoxy:x:103:65534::/etc/privoxy:/bin/false
testuser:x:1501:100::/home/testuser:
+::::::
maia[45]:~# adduser test2
Adding user `test2'...
make: Entering directory `/var/yp'
make[1]: Entering directory `/var/yp/analysis.borex'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating netid.byname...
Updating shadow.byname...
make[1]: Leaving directory `/var/yp/analysis.borex'
make: Leaving directory `/var/yp'
Adding new group `test2' (1019).
make: Entering directory `/var/yp'
make[1]: Entering directory `/var/yp/analysis.borex'
Updating netid.byname...
make[1]: Leaving directory `/var/yp/analysis.borex'
make: Leaving directory `/var/yp'
Adding new user `test2' (1019) with group `test2'.
make: Entering directory `/var/yp'
make[1]: Entering directory `/var/yp/analysis.borex'
Updating netid.byname...
make[1]: Leaving directory `/var/yp/analysis.borex'
make: Leaving directory `/var/yp'
Creating home directory `/home/test2'.
Copying files from `/etc/skel'
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for test2
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [y/N] y
make: Entering directory `/var/yp'
make[1]: Entering directory `/var/yp/analysis.borex'
Updating passwd.byname...
Updating passwd.byuid...
Updating netid.byname...
Updating shadow.byname...
make[1]: Leaving directory `/var/yp/analysis.borex'
make: Leaving directory `/var/yp'
maia[46]:~# tail -n 3 /etc/passwd
testuser:x:1501:100::/home/testuser:
test2:x:1019:1019:,,,:/home/test2:/bin/bash
+::0:0:::


I attach the contents of my /etc/adduser.conf and
/usr/local/sbin/adduser.local.

Please let me know if you need further information (NIS config files,
etc.) and I will be better about replying quickly.

regards,

-- 
Kevin B. McCarty <kmccarty at princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG: public key ID 4F83C751                 Princeton, NJ 08544
-------------- next part --------------

# /etc/adduser.conf: `adduser' configuration.
# See adduser(8) and adduser.conf(5) for full documentation.

# The DSHELL variable specifies the default login shell on your
# system.
DSHELL=/bin/bash

# The DHOME variable specifies the directory containing users' home
# directories.
DHOME=/home

# If GROUPHOMES is "yes", then the home directories will be created as
# /home/groupname/user.
GROUPHOMES=no

# If LETTERHOMES is "yes", then the created home directories will have
# an extra directory - the first letter of the user name. For example:
# /home/u/user.
LETTERHOMES=no

# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
SKEL=/etc/skel

# FIRST_SYSTEM_UID to LAST_SYSTEM_UID inclusive is the range for UIDs
# for dynamically allocated administrative and system accounts.
FIRST_SYSTEM_UID=100
LAST_SYSTEM_UID=999

# FIRST_UID to LAST_UID inclusive is the range of UIDs of dynamically
# allocated user accounts.
FIRST_UID=1000
LAST_UID=29999

# The USERGROUPS variable can be either "yes" or "no".  If "yes" each
# created user will be given their own group to use as a default, and
# their home directories will be g+s.  If "no", each created user will
# be placed in the group whose gid is USERS_GID (see below).
USERGROUPS=yes

# If USERGROUPS is "no", then USERS_GID should be the GID of the group
# `users' (or the equivalent group) on your system.
USERS_GID=100

# If QUOTAUSER is set, a default quota will be set from that user with
# `edquota -p QUOTAUSER newuser'
QUOTAUSER=""

# If DIR_MODE is set, directories will be created with the specified
# mode. Otherwise the default mode 0755 will be used.
DIR_MODE=0755

# If SETGID_HOME is "yes" home directories for users with their own
# group the setgid bit will be set. This was the default for
# versions << 3.13 of adduser. Because it has some bad side effects we
# no longer do this per default. If you want it nevertheless you can
# still set it here.
SETGID_HOME=no
-------------- next part --------------
#!/bin/sh
# This script is called by adduser after it finishes setting up.
# Two corrections that must be made:

# 1) Change +::0:0::: back to +:::::: in /etc/passwd
# 2) Update NIS info

PATH=/usr/bin:/bin

# Commented out the next three lines to test whether bug #150186 still happens:
#umask 022
#sed -e 's,+::0:0:,+::::,g' /etc/passwd > /etc/passwd.tmp
#mv /etc/passwd.tmp /etc/passwd

# since we've changed password files, need to update NIS again
# I've tried commenting the following line out, but it makes no difference
# to bug #150186; also, of course, commenting it out means that the exported
# NIS data isn't updated properly.
make -C /var/yp



More information about the Adduser-devel mailing list