Linux : How to change User and Group ID

By | November 11, 2017

There might be some (rare) circumstances where you would like to change a UID or GID on Linux system.

If you know what you are doing and the implication behind this change (see warning comment below), this can be achieved using the commands below.

Change User ID (UID) :

Example :

Change Group ID (GID) :

Example :

Warning! Changing UID or GID will NOT apply apply on the filesystem. You will have files and folders left with numerical ownership values and the user and/or group that you just changed will not own these files and/or folders anymore. Manual change need to be applied. As you can imagine, if you are doing such operation for a user/group that run an application such as an Oracle database for example, the application should be stopped prior this change.

Note : UID and GID are 32 bits, therefore have a limitation of 232-1 (4 294 967 295), however there is a soft limit in place of 60 000, which is in my opinion way more than what is needed for common use. If needed, you can edit that limit in /etc/login.defs on RHEL.