The usermod command with the -l or --login command can be used to change a username. In this example, the username is changed from user1 to user2.
[root@server1 ~]# usermod -l user2 user1
The first field in the /etc/passwd file will show the new username (user2 in this example). The home directory is not changed from /home/user1 to /home/user2.
[root@server1 ~]# cat /etc/passwd user2:x:1002:1002::/home/user1: . . .
The first field in the /etc/shadow file will show the new username (user2 in this example).
[root@server1 ~]# cat /etc/shadow user2:!:17014:0:99999:7::18350: . . .
Refer to the usermod command.