Modify the user name (take CentOS-8 as an example)
①Enter the root
user for operation, and /etc/sudoers
addadmin(新用户名) ALL=(ALL) ALL
su root
vim /etc/sudoers
② enter /etc/passwd
will 旧用户名
be changedadmin(新用户名)
vim /etc/passwd
③ enter /etc/group
will 旧用户名
be changedadmin(新用户名)
vim /etc/group
④ enter /etc/shadow
will 旧用户名
be changedadmin(新用户名)
vim /etc/shadow
⑤ enter /etc/gshadow
will 旧用户名
be changedadmin(新用户名)
vim /etc/gshadow
⑥Enter the /home
directory and change the file 旧用户名
to新用户名
cd /home
mv test(旧用户名) admin(新用户名)
⑦ reboot
restart