RHEL: How to change a USER/GROUP UID/GID and all owned files

RHEL: How to change a USER/GROUP UID/GID and all owned files

# How to change a UID/GID and all belonging files


# Assign a new UID to USER. Any files which the user owns and which are located in the
# directory tree rooted at the user's home directory will have the file user ID changed
# automatically. Files outside of the user's home directory must be altered manually.

usermod -u $NEWUID $USER

# Assign a new GID to GROUP. Any files which the old group ID is the file group ID must
# have the file group ID changed manually.

groupmod -g $NEWGID $GROUP

# Manually change files with old UID

find / -user $OLDUID -exec chown -h $USER {} \;

# Manually change files with old GID

find / -group $OLDGID -exec chgrp -h $GROUP {} \;
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Script to Offline and Remove A Disk In Linux
Viewed 1763 times since Mon, Jan 28, 2019
How to accurately determine when the system was booted
Viewed 2115 times since Wed, Oct 3, 2018
LVM basic
Viewed 2012 times since Sat, Jun 2, 2018
20 Linux YUM (Yellowdog Updater, Modified) Commands for Package Management YUM
Viewed 11048 times since Thu, Oct 25, 2018
Open SSL HowTo: Decode SSL Certificate
Viewed 5874 times since Mon, Feb 18, 2019
RHEL: Checking HBAs
Viewed 14301 times since Sun, May 27, 2018
Linux get the list of FC HBA’s and WWPN
Viewed 2949 times since Tue, May 22, 2018
Linux / UNIX: Run Command a Number of Times In a Row
Viewed 15635 times since Tue, Aug 6, 2019
Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7
Viewed 2782 times since Mon, Oct 29, 2018
HowTo: Send Email from an SMTP Server using the Command Line
Viewed 1639 times since Mon, Feb 18, 2019