====== Changing a User's UID ====== Having consistency of UID and GID on UNIX is extremely important if you have multiple servers and clients that you want to maintain a consistent identity on. Be it for [[https://en.wikipedia.org/wiki/Network_File_System|NFS]], [[https://git-scm.com/|Git]], or any other administrative task. Having the same IDs for your users across different computers really helps. Sadly, almost no OS install utilities allow you to specify the UID/GID of the default user that's created during setup, which means we have to do this afterward, thus this tutorial exists to give me and everyone a clear path to UID consistency. ===== Linux ===== I almost always run [[https://www.debian.org/|Debian]] on my Linux machines, thus I can't say this is the right way of doing it in other distros, I can't see why it wouldn't apply to others as well. # Ensure no processes are running from the old user. pkill -U $OLD_UID # Change UID/GID using usermod. usermod -u $NEW_UID -g $NEW_GID $USERNAME # Fix file permissions to use the new UID. find / -uid $OLD_UID -exec chown -h $NEW_UID {} + find / -gid $OLD_UID -exec chgrp -h $NEW_GID {} + If you're using a Raspberry Pi with its graphical desktop environment, you should use ''raspi-config'' to disable booting straight to X.