Created
April 23, 2018 23:20
-
-
Save gregjhogan/f7fb641a2d44c3d07d289677f753c24a to your computer and use it in GitHub Desktop.
change user's user ID and group ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| LOGIN=<USER> | |
| NEWUID=<NEWUID> | |
| NEWGID=<NEWGID> | |
| OLDUID=<OLDUID> | |
| OLDGID=<OLDGID> | |
| usermod -u $NEWUID $LOGIN | |
| groupmod -g $NEWGID $LOGIN | |
| find / -user $OLDUID -exec chown -h $NEWUID {} \; | |
| find / -group $OLDGID -exec chgrp -h $NEWGID {} \; | |
| usermod -g $NEWGID $LOGIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment