changing uid,gid

Hi,

I am new to scrippting need little help, I would like to change uid, gid of exisisting user,

example

User A current uid=1,gid=2 would like to change uid=4,gid=5

I know the command to change uid,gid but after changing I have to change permissions on folders also which are belonging to that user,

so how to change old uid,gid to new uid,gid on all the folder whose owner is A.

Regards

Manoj

Try this

find / -user <old uid> -exec chown <new uid> {} \;

regards,
Ahamed

Using find and xargs or -exec, check man find for supported options.

Regards.
Peasant.

Oh, Ahmed beat me to it :slight_smile:

Using your example UID and GID (multiplied by 100 just for my example): However we do hope that you are not actually changing the unix account with UID 1 because your system will probably stop working.

find / -user 100 -exec chown 300:400 {} \;