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

Administrative commands for Linux users and groups

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

Share

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

Useradd add a new user (you must set a password to add a new user, otherwise you cannot log in)

Useradd + user name is added directly to create a new user.

Useradd option user name

-u UID specify user UID

-d home directory specifies the user's home directory

-c user description specifies user description

-g user group name specifies the user initial group

-G user group name specifies the user additional group

-s shell specifies the login shell of the user. The default is / bin/bash

/ sbin/nologin cannot log in.

Passwd modifies user password

Passwd + user name changes the user's password

Passwd option user name

-S queries the password status of the user (only root is available)

-l temporarily lock down users (only root is available)

-u unlock users (only root is available)

-- data output by stdin through pipe characters as user passwords (for batch creation of user passwords) is non-interactive

Userdel deletes a user (you can check whether the user has been deleted by querying the user's UID)

Userdel-r user name deletes the user's home directory while deleting the user

Usermod modifies user attributes

-s modify user's login shell / bin/bash or / sibin/nologin disable login

-u UID modifies the user's UID number

-c user description modifies user's description information

-G group name modifies the user's additional group

-L temporarily lock user lock

-U unlock the user's unlock

Groupadd add user Group

Groutadd option group name

-g GID specifies the group ID (1000 to 1000 +)

Gpasswd users are added to or removed from additional groups (it is recommended to change them under / etc/group)

Gpasswd option group name

-a user name adds the user to the group

-d user name removes the user from the group

Groupdel deletes a user group

Groupmod modifies user group information

Groupmod option group name

-g GID reorganizes ID

-n + new group name modify new group name (it is not recommended to change, it is better to delete and re-create)

Id views the user's UID GID group ID

Id + user name

Chage modifies the password status of a user (it is recommended to change it under / etc/shadow)

Chage option user name

-l list the detailed password status of the user

-d + date date password was last modified

-m + days the interval between two password changes

-M + days to change the password validity period

-W + days the number of warning days before the password expires

-I change the number of days after the password expires

-E account expiration time

Su switches user identity

Su option user name

Switch together with the user's environment variables

-c executes the command only once and does not switch user identity

Sudo executes commands that are previously allowed in the sudoers file as another user (the default root user).

Such as: shutdown, restart, add new users. (system command)

Sudo-l to see the available sudo commands (see the last few lines after entering the password)

Sudo + commands (built-in commands are not available) ordinary users execute the permissions given by sudo

Exclusive commands for visudo editing / etc/sudoers files.

Visudo = vim / etc/sudoser (not recommended)

98 or 107 line username or group name managed host address = (usable identity)\

Authorization command (absolute path) NOPASSWD:ALL indicates login without a password

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