How to change the user name in CentOS

Source: Internet
Author: User
1. modify the user name, user group, and home directory in the/etc/passwd file. 2. modify the user name and user group in the/etc/group file; at the same time, rewrite the/etc/gshadow file. 3. modify the username section in the/etc/shadow file. if this is not changed, you cannot log on to the system; 4. change/home/olduser to/home/newuser, and be sure to modify the user and user group to which it belongs, 1. modify the user name, user group, and home directory in the/etc/passwd file;
2. modify the username and user group in the/etc/group file, and rewrite/etc/gshadow;
3. modify the username in the/etc/shadow file. If this parameter is not changed, you cannot log on to the system;
4. modify/home/olduser to/home/newuser. Make sure to modify the user and user group to which the user belongs. add a-R to chown, which is critical;


Note: All the above are modified manually,
If you want to modify it all at once, try the usermod-l command, usermod-l old username new username

The usermod command cannot be used to change the folder name in the/home directory. you need to view the above four parts and modify the ones that have not been changed.

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.