File owner name not updated.

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Mar 26 08:13:12 PST 2003


On Tue, Mar 25, 2003 at 11:44:52PM -0800, Kevin Stevens wrote:
> 
> On Tuesday, Mar 25, 2003, at 23:29 US/Pacific, Matthew Seaman wrote:
> 
> >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.
> 
> Just tried running that after creating a dummy user and changing his 
> uid from 1005 to 1010.  No change.
> 
> >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), 
> >eg:
> >
> >    % perl -e 'print scalar getpwuid(503), "\n";'
> 
> bash-2.05b# perl -e 'print scalar getpwuid(1010), "\n";'
> fred
> bash-2.05b# perl -e 'print scalar getpwuid(1005), "\n";'
> fred
> 
> 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 
    % id -P fred
    fred:*:1010:1010::0:0:User &:/home/fred:/bin/sh
    % ls -lad /home/fred 
    drwxr-xr-x  2 fred  fred  512 Mar 26 08:01 /home/fred/
    % sudo pw user mod fred -u 1005
    % id -P fred 
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh
    % ls -lad /home/fred 
    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 
    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 
    % id -P fred 
    fred:*:1005:1010::0:0:User &:/home/fred:/bin/sh
    % id -P 1005 
    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/
    
Looks like a bug to me...

	Cheers,

	Matthew

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030326/2371441e/attachment.bin


More information about the freebsd-questions mailing list