Change user ID and group ID

All UNIX are using UID / GID for authentification.

Then file /etc/passwd and /etc/group are the reference to map a user with his ID.

All files and folders belong to an UID / GID, so this is the most important concept to keep in mind.

If you have conflict with sharing files beetween UNIX servers, you have to have identical UID and GID for all users.

Here are steps to change UID/GID when possible

Make a backup of all files/folders concerned by modifications

# find / -user force -ls > user_force.txt
# find / -group sales -ls > group_sales.txt

Make a copy of groups and check which user has a secondary group as sales

# cat /etc/group > /etc/group.bkp

Check that no process is active on this user

# ps -ef | grep sales

Else stop all processes started by the user

To assign a new UID / GID to user called force group sales, enter:

# usermod -u 2005 force
# groupmod -g 3000 sales

Update files and foler with new UID et GID:

# find / -uid 1005 -exec chown -v force {} \;
# find / -gid 2000 -exec chgrp -v sales {} \;