To change a user's UID (User Identifier) in Linux, you can use the usermod command. Here’s how to do it:
Syntax:
sudo usermod -u NEW_UID USERNAME
Steps:
- Open Terminal.
- Run the command:
ReplaceNEW_UIDwith the desired UID andUSERNAMEwith the name of the user whose UID you want to change.
Example:
sudo usermod -u 6000 labex
Important Notes:
- File Ownership: After changing the UID, you may need to update the ownership of files owned by the old UID. You can do this with:
sudo find / -user OLD_UID -exec chown -h NEW_UID {} \; - Logout/Login: The user may need to log out and back in for the changes to take effect.
Make sure to back up important data before making changes to user accounts. If you have further questions, feel free to ask!
