How to change or rename user name and UID (user-id)
Wednesday, December 3rd, 2008Use the usermod command to change user name under Linux. it modifies the system account files to reflect the changes that are specified on the command line.
Use the usermod command to change user name under Linux. it modifies the system account files to reflect the changes that are specified on the command line.
1.) Firstly, lock the account to prevent the user from using the login until the change has been made:
# usermod -L <username>
2.) Change the password expiration date to 0 to ensure the user changes the password during the next login:
# chage -d 0 <username>
3.) To unlock the account after the change do the following:
# usermod -U <username>