Ubuntu modifies user name and hostname |ubuntu into standalone mode (single user mode)

Source: Internet
Author: User

Question: Use a week Ubuntu14.04, feel oneself originally set the username and hostname is too long, want to modify.

The result: One night passed, or a tragedy.

Google search: Ubuntu modified the user name, looked at the first students in the article, according to the description to modify/etc/passwd and/etc/shadow, the old user name is modified to a new user name, after the completion of the modification to restart, and then the tragedy.

Although the new user name is displayed, but after entering the password, still stay in the original interface, unable to enter the system under the new user. Only the guest user system can be entered, but the guest user cannot enter the root user and cannot make any changes.

The reason is that you also need to modify the/etc/group to change all the old user names under this file to the new username, which can occur if you do not modify the file or omit the changes.

The next step is to give the correct manual modification steps and the method of changing into root mode after the tragedy.

1.su-Enter the root user

2.vim/etc/hostname (or Open with Gedit/etc/hostname) This is to modify the host name, if you just modify the user name, it can be ignored.

3.vim/etc/passwd

4.vim/etc/shadow

5.vim/etc/group

The corresponding results are as follows:

After Vim/etc/hostname, the old hostname in the hostname folder is displayed, which is changed directly to the new hostname, so that the new host name is displayed after the reboot.

VIM/ETC/PASSWD, modify the old user name in the file to a new user name, such as the user name at the cursor, and note that other places cannot be changed.

Vim/etc/shadow the old user name in the modified file is the new user name and cannot be changed elsewhere.

Vim/etc/group Modify the old user name in the file is a new user name, note that there are many changes in this file, you must not miss.

Note If you want to manually modify the user name, the old user names in these files need to be modified for the new user name, otherwise it can be tragic.

After the modification, look for the old user name (such as liubingbing), you can use the Locate command: Locate liubingbing (because it looks fast)

We found that most of the old user name liubingbing related files no longer exist (if not modified before the search is very much), only the few left, the explanation has been modified well. Because the locate needs to be pre-established, the database is updated daily by default (Linux entry basic--linux system common Command http://blog.csdn.net/yiranant/article/details/46005219), As we can see from/var/cache, VAR stores frequently changing information (Linux entry base--linux system directory architecture)

Ubuntu modifies user name and hostname |ubuntu into standalone mode (single user mode)

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.