Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Mar 2003 08:13:07 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        questions@freebsd.org
Subject:   Re: File owner name not updated.
Message-ID:  <20030326081307.GC5568@happy-idiot-talk.infracaninophi>
In-Reply-To: <D4A3ED06-5F5E-11D7-95E4-000A959CEE6A@pursued-with.net>
References:  <20030326072922.GA5568@happy-idiot-talk.infracaninophi> <D4A3ED06-5F5E-11D7-95E4-000A959CEE6A@pursued-with.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--kVXhAStRUZ/+rrGn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Mar 25, 2003 at 11:44:52PM -0800, Kevin Stevens wrote:
>=20
> On Tuesday, Mar 25, 2003, at 23:29 US/Pacific, Matthew Seaman wrote:
>=20
> >Two things occur to me:
> >
> >    i) Did root use vipw(8) to edit the passwd database, or otherwise
> >       run:
> >
> >        # cap_mkdb /etc/master.passwd
> >
> >       when the UID was changed?  It's the value in the hashed
> >       database cap_mkdb(1) builds that is used by the system.
> >       Updating that should have instantaneous effect.
>=20
> Just tried running that after creating a dummy user and changing his=20
> uid from 1005 to 1010.  No change.
>=20
> >The problem is not with the ls(1) command per se.  It's the underlying
> >system library functions such as getpwuid(3) which do the translation
> >between numeric UIDs and usernames that are the seat of the problem.
> >You can see that by running some other command that uses getpwuid(3),=20
> >eg:
> >
> >    % perl -e 'print scalar getpwuid(503), "\n";'
>=20
> bash-2.05b# perl -e 'print scalar getpwuid(1010), "\n";'
> fred
> bash-2.05b# perl -e 'print scalar getpwuid(1005), "\n";'
> fred
>=20
> bash-2.05b# grep fred /etc/master.passwd
> fred:*:1010:1005:User &:/home/fred:/bin/sh

Interesting.  I can reproduce exactly what you're seeing:

    % sudo pw user add -n fred -u 1010 -m=20
    % id -P fred
    fred:*:1010:1010::0:0:User &:/home/fred:/bin/sh
    % ls -lad /home/fred=20
    drwxr-xr-x  2 fred  fred  512 Mar 26 08:01 /home/fred/
    % sudo pw user mod fred -u 1005
    % id -P fred=20
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh
    % ls -lad /home/fred=20
    drwxr-xr-x  2 fred  fred  512 Mar 26 08:01 /home/fred/
    % id -P 1005
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh
    % id -P 1010
    fred:*:1010:1010::0:0:User &:/home/fred:/bin/sh
    % sudo grep 1010 /etc/master.passwd=20
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh

However, running pwd_mkdb(8) seems to cure the problem very effectively:

    % sudo pwd_mkdb /etc/master.passwd=20
    % id -P fred=20
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh
    % id -P 1005=20
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh
    % id -P 1010
    id: 1010: no such user
    % ls -lad /home/fred
    drwxr-xr-x  2 1010  fred  512 Mar 26 08:01 /home/fred/
   =20
Looks like a bug to me...

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--kVXhAStRUZ/+rrGn
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+gWETdtESqEQa7a0RAvGPAJ9nmy/bGXgr7Xc5BXRpf52CuTsq1gCggbVd
56SxzJsjS0XShSc4CCVYT8g=
=rO/B
-----END PGP SIGNATURE-----

--kVXhAStRUZ/+rrGn--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030326081307.GC5568>