changeuid

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.

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 <username>
id <username>

This will give you all the output you need. Now use these commands to change the UIDs and ownership of the files:

usermod -u <NEWUID> <LOGIN>
groupmod -g <NEWGID> <GROUP>
find / -user <OLDUID> -exec chown -h <NEWUID> {} \;
find / -group <OLDGID> -exec chgrp -h <NEWGID> {} \;
Note that on old versions you might also have to do this: usermod -g <NEWGID> <LOGIN>. 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.

changeuid.txt · Last modified: by 127.0.0.1

Exception: Git command failed to perform periodic pull: From https://dev.azure.com/getshiftingcom/Documentation/_git/knowledge * branch main -> FETCH_HEAD There is no candidate for rebasing against among the refs that you just fetched. Generally this means that you provided a wildcard refspec which had no matches on the remote end.

Exception: Git command failed to perform periodic pull: From https://dev.azure.com/getshiftingcom/Documentation/_git/knowledge * branch main -> FETCH_HEAD There is no candidate for rebasing against among the refs that you just fetched. Generally this means that you provided a wildcard refspec which had no matches on the remote end.

An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the gitbacked plugin.

More info has been written to the DokuWiki error log.