SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/06/22 10:36 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

changeuid

Change User UID and GID on Red Hat

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.

You could leave a comment if you were logged in.
changeuid.txt · Last modified: 2014/11/28 15:16 by sjoerd