= Change User UID and GID on Red Hat =
**Summary**: How to change the UID and or GID on Red Hat. \\
**Date**: Around 2015 \\
**Refactor**: 21 February 2025: Checked links and formatting. \\
{{tag>linux}}
Follow these commands to change the user's uid and primary group gid.
First check the users UID and GID, as well as the GIDs name like this:
cat /etc/passwd | grep
id
This will give you all the output you need. Now use these commands to change the UIDs and ownership of the files:
usermod -u
groupmod -g
find / -user -exec chown -h {} \;
find / -group -exec chgrp -h {} \;
> Note that on old versions you might also have to do this: {{{usermod -g }}}. On new versions this is not longer required.
> Note that if you have NFS shares which also holds these uid/gid you need to follow the same procedure there if you have root squash enabled. You will get permission denied messages when you run into this.