change user id from 200 to 202

Hi AIX Experts,

i need your help in this issue,
i want to change user id of xyz user from 200 to 202
note that this xyz user owner for many files and directories

so my issue how to change the user id from 200 to 202 and the files still under his ownership

this is an urgent work , please help.

thanks
Sherif

hmm... give that, at the time you change the UID on the user (usermod -u 202 xyz) the UID on the files will no longer belongs to a valid user, this should allow you to use find with the -uid flag, in order to search for all the files owned by UID=200, this result you can parse through xargs demanding a chown xyz on the files, which in theory should provide you with the desired change on your system.

How ever, be aware the user in question should not be loged in on your system at the time of the change.

Dear Redhead,
Could you please give script for this steps
because i don't know how to do that
thanks
sherif

# usermod -u 202 xyz

Can be executed anywhere, now user xyz has a UID of 202, leaving every file owned by user xyz marked as owned by UID 200 instead of user xyz.

# chown xyz `find / -uid 200`
Can be executed from anywhere, it will search from the root finding any file owned by UID 200, which was the users previus userID, effectively changing it back to user xyz which by this time has UID 202.

This might or might not work, depending on the number of files found that way. The following will work regardless of how many files there are:

find / -uid 200 -exec chown <username>:<usergroup> {} \;

I hope this helps.

bakunin