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

The usage of the Linux basic command usermod

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "the usage of Linux basic command usermod", in daily operation, I believe many people have doubts about the usage of Linux basic command usermod, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "Linux basic command usermod" doubts helpful! Next, please follow the small series to learn together!

usermod

Modify user information, including username, password, home directory, uid, etc.

This command applies to Red Hat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

usermod [options] [parameters]

2. Option list

option

description

--help

Show Help Documentation

--version

Show command version

-c comment

Modify Remarks

-d home_dir

Modify the directory used for each login of the account

-e expire_date

Modify account termination date, MM/DD/YY

-f inactive_days

How long after the account expires

-g initial_group

Modify the account group. This group must exist.

-G group,[...]

Modify additional groups for users

-l login_name

The login name is changed to login_name, and the rest remains unchanged. In particular, the user directory name should also be changed to the new login name.

-s shell

Change the shell used after login

-u uid

Modify User ID

3. Documents

/etc/passwd, user account information.

/etc/shadow, user account information encryption.

/etc/group, group information.

4. Examples

1) Modify user uid

[root@localhost david]# tail -n 2 /etc/passwd //View user information

webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin

user01:x:502:502::/home/user01:/bin/bash

[root@localhost david]# usermod -u 503 user01 //change uid to 503

[root@localhost david]# tail -n 2 /etc/passwd //View user information, uid has changed

webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin

user01:x:503:502::/home/user01:/bin/bash

2) Modify remarks

[root@localhost david]# usermod -c "user01 test" user01 //modify comment information to "user01 test"

[root@localhost david]# tail -n 2 /etc/passwd //View user information

webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin

user01:x:503:502:user01 test:/home/user01:/bin/bash

At this point, the study of "the usage of Linux basic command usermod" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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