Two ways to change the name of a Linux user-recommended way two-high-force lattice mode three

Source: Internet
Author: User

mode One: Enter change user name from recovery mode, resolve only one user but I love to use the command to change the question

Prerequisite Knowledge: 1. Understand the meaning of user information as described in the/etc/passed file, for example: representing delimited information;/home/ycp on behalf of the user directory

2. Understand the use of the Usermod command, for example,-C To change user description information (the name that is displayed when logging on to the system is descriptive)-L indicates user name (can not be inconsistent with description information)-D means user directory, etc., use man usermod to query the use method in detail

First step: Enter recovery mode

1. Restart long press SHIFT to enter the Grub menu, press shift a bit earlier

2. The upper and lower key is selected figure recovery mode, do not press ENTER, press E, indicating the editing of the startup parameters, appear as

3. Key to RO recovery nomodeser to RW single Init=/bin/bash as shown below

4. Press F10 to enter the root single user mode as follows, you can change the file and folder under this mode, you can change the user name freely. RO indicates read-only, RW indicates readable and writable

5. After typing the following command

A Enter/home change user folder name: MV Ycp Topeet

B. Change user name: Usermod-l ycp Topeet

C. Changing user description information: usermod-c ycp-pc ycp #注意, user's name was changed from Topeet to YCP,YCP-PC for login at the previous command

D. Changing the user directory: usermod-d/home/ycp YCP

Just reboot.

6.RW single Init=/bin/bash do not change back to RO recovery Nomodeser, the system will revert to ro recovery nomodeser

7. Problems that occur during the process

7.1 Directly in the recovery mode, the normal interface Su-enter the root using the command usermod-l YCP topeet changes will prompt the Topeet user has logged in, that is, cannot change the user who is logged in.

Because my system in addition to some pseudo-users of the system itself (UID: 1~499, also known as the system reserved account) and root user only a user topeet, so the login is topeet, resulting in cannot change, if there are two users, Log in with another user and then log off the Topeet and change the user name.

Only one user, under root use pkill-t Tty7 logout Topeet will return to the login interface, resulting in change, this is the way a solution to the problem. w command to see which users are logged in

7.2 to the RW single Init=/bin/bash when written in the RW single Init=/bash/bin, will cause press F10 to enter the bash, restart the correct fill on the line

7.3 Change the user name on the restart, resulting in the correct password can not be entered, is because the name of the login has not changed, enter and change usermod-c ycp-pc ycp OK

7.4 Change the landing ycp-pc a piece of black, thought changed the wrong where, in fact, is the problem of login options, as follows: false alarm

It is because the choice of recovery mode, choose back to Ubuntu just fine.

Here the recovery mode and the previous is a difference, or can not change the user name, because it is logged in the current user, carefully look at the root display state is not the same.

mode two: refer to http://www.jianshu.com/p/11cd3564855c directly modify the following file/method simple in fact, the action of the way one is to modify the file/etc/passwd and/etc/shadow, But not modified/etc/group,/etc/gshadow, but still valid, because the user ycp belong to the GID (group ID) or 1000, did not change, or belong to the Topeet group, the name of the group is not the most significant, can also change the name. The difference is that the command Usermod will modify both/etc/passwd and/etc/shadow, and the file will not be modified directly.

/etc/passwd

/etc/shadow

/etc/group

/etc/gshadow

/etc/sudoers #不更改似乎没有影响, the user mode can still use sudo without prompting for errors, the text mentioned in the present error.

Actually knew these files before, but did not change, thought cannot modify, because the password section shows that x is encrypted. Command passwd YCP can change the password. But, well, understand the way into the recovery, perhaps later do not have his use. A detour is not necessarily a bad thing, but one more way to the destination.

mode three: from the settings into the change, too low-end, graphical interface, and can only modify the user name, password, can not modify the group GID, user directory and so on, far from the display to engage in the high-forcing Linux knock command lattice. The result of the graphical interface also modifies the file.

    

Learn only in this record-2017.9.29

    

Two ways to change the name of a Linux user-recommended way two-high-force lattice mode three

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.