Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2013 17:12:27 +0100
From:      Frank Leonhardt <frank2@fjl.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: Renumber users and groups
Message-ID:  <5214E6EB.30102@fjl.co.uk>
In-Reply-To: <u9zjsb8bkz.fsf@banyan.cs.ait.ac.th>
References:  <u9zjsb8bkz.fsf@banyan.cs.ait.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
On 21/08/2013 13:36, Olivier Nicole wrote:
> Hello,
>
> On my system legacy users come with UID starting from 200 upward, and
> all users come with GID lower that 100.
>
> I know it's not a good idea, but consider that some accounts are over 20
> years old!
>
> This is not too much a problem with FreeBSD as I can renumber the few
> FreeBSD services that have a conflicting ID.
>
> But now I want to share the user directories with Mac (10.6). On Mac,
> any id lower than 512 should be reserved for the system.
>
> I tried to renumber the conflicting services on Mac OS, but it messes up
> the system.
>
> So I should renumber my users; it's not very difficult to do, but I have
> over 1TB of user files for 200 users.
>
> Is there a clever/fast way to do that (other than find -exec chown)?
>
> What pitfall should I avoid?
>
> Best regards,
>
> Olivier

Both tar and rsync are spectacularly clever about this. I've never 
needed to renumber users, but I've noticed tar will restore a backup 
across hosts and try to resolve user names correctly. tar stores users 
and groups symbolically and will happily extract them to the correct 
numerical ID on the new host. All you need do, therefore, is merge the 
passwd and group files without conflict and "untar" everything. If 
you've got to do this in-place it's not going to work, but as you'd be 
wise to make a backup anyway you may as well make a copy instead, and 
let it convert them on the fly. rsync seems to pull the same trick.

Regards, Frank.




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