From: http://blog.chinaunix.net/space.php? Uid = 1852374 & Do = Blog & cuid = 195232 today, I got the answer to the question of modifying the user name. A friend of the Cu forum named "ghostfisher" helped me. thank you for your help.
My problem is:
I am in Ubuntu. I want to change user name a to user B. What should I do without deleting user a and creating user B?
The answer is:
This is very simple. Find the/etc/passwd file and use the VI editing tool to open it. The content is probably like this.
Username: X: uid: GID: Remarks: main directory path: Shell path
The colon is separated by the login name, password (X represents the password), user ID, group ID, and so on.
Generally, you only need to consider the information with a uid greater than 500. The default system user is less than 500, and the default uid of the new user starts from 500.
Find the user information to be modified, directly change the username from a --> B, and save and exit.
This is only half done,
Next, find the/etc/shadow file and open it with VI.
User A's information is also available here.
Because Linux only uses UID to identify users. Therefore, although you have changed the username, the UID has not been changed. Therefore, you will use the modified username to log on next time. However, the user's home directory will not change.
The preceding operations are in RedHat, thiz, or UNIX. However, Linux versions are basically accessible.
The token tn you mentioned has never been used, but it should be the same. Try it.
So I did what this guy said.
Vim/etc/passwd
Change the username "ubuntu" I want to change to "Lee". I often use the name "Lee", but it was wrong in the fashion system!
Save and exit
Vim/etc/shadow
Similarly, I changed "ubuntu" to "Lee"
Save and exit
Starting from the host, all right. My original user name cannot be logged on, and the new "Lee" can be changed. So the name is changed to Lee @ Ubuntu: