Change username in Linux

In Unix, all permissions, files, etc are tied to uid, not username. So we can safely change the name without affecting the ID.

To change username follow the steps below.

Step1: Login as root

Step2: Change username

#usermod -l newusername oldusername

Step3: Change homedir

#usermod -d /home/newhomedir -m newusername

 

Leave a Reply

Your email address will not be published. Required fields are marked *