Questions about username modification in Ubuntu

Source: Internet
Author: User

 

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.