Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify user name in Linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to modify the user name in Linux system". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "how to modify the user name in Linux system" together!

modify the username

We use usermod to modify user names. Its syntax is,

$ usermod -l new_username old_username

As an example, suppose we have a user named dan who wants to rename himself susan, then execute the following command on the terminal:

$ sudo usermod -l susan dan

This only changes the username, while everything else, such as user groups, home directories, UID, etc., stays the same.

Note: -You need to log out of the account you want to rename and kill all processes of that user. To kill all processes of that user, execute the following command

$ sudo pkill -u dan$ sudo pkill -9 -u dan Modify Home

To change the home directory at the same time, we need to add the-d option to the usermod command,

$ sudo usermod -d /home/susan -m susan Change User UID

Execute the following command to modify the User UID

$ sudo usermod -u 2000 susan

Here 2000 is the user's new UID.

Modify user group name

To change the user group name from dan to susan, we need to use groupmod. Use the following command to modify the user group name,

$ groupmod -n susan dan

After making the changes, you can use the id command to check that

$ id susan Thank you for reading, the above is the "Linux system how to modify the user name" content, after the study of this article, I believe that everyone on the Linux system how to modify the user name this problem has a deeper experience, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report