[CentOS] Changing UID numbers

Matthew Miller mattdm at mattdm.org
Thu Feb 14 17:45:33 UTC 2019


On Thu, Feb 14, 2019 at 11:04:11AM -0600, Bill Gee wrote:
> I think I can do this in two steps.  
> 0) backup, backup, backup!

This is already running and you've tested the restore process, right?

> 1) On the server - use "find" to find all files owned by UID=500. Chown
> them to UID=1000. Repeat for gid=500.

Yes.

> 2) Tricky - On the workstation, boot to non-gui. Login as root. Repeat the
> same two "find" commands as on the server. Edit the /etc/passwd and
> /etc/group files to show the new UID and GID numbers.

Yes. Although order does not matter -- personally I'd make the account
change first.

Also, you can use `usermod -u` and `usermod -g` (possibly both at once) and
this will correctly change ownership of all files in the home directory
(but not outside of that).

> What does this do to the shadow files? Are there other places I need to
> look for the UID and GID numbers?

shadow (and gshadow) are name based, so shouldn't be a problem. You may need
to change some spool files in /var in addition to in /home.

Nothing else *should* be using the numeric values. (Possibly some tar
files?)

-- 
Matthew Miller
<mattdm at fedoraproject.org>
Fedora Project Leader


More information about the CentOS mailing list