How to change user GID and UID

In certain situation may be helpful to change uid and gid of a particular user in your Ubuntu box. In this case you have first to verify that no process is running with the original user. If there are some process...you have authorized to kill them all. :) Then, run the follow script where substitute the NEWUID and OLDID with yours.
usermod -u <NEWUID> <LOGIN>    
groupmod -g <NEWGID> <GROUP>
find / -user <OLDUID> -exec chown -h <NEWUID> {} \;
find / -group <OLDGID> -exec chgrp -h <NEWGID> {} \;
usermod -g <NEWGID> <LOGIN>

Nessun commento:

Posta un commento