How Linux views users and user groups

Source: Internet
Author: User
Tags addgroup


Feature Description: Find and display user information.

Syntax: whois [account name]

Supplemental Note: The WHOIS directive will go to find and display the user related information of the specified account, because it is to network Solutions's whois database to look up, so the account name must be registered on the above can be found, and the name is not case-sensitive difference.



Function Description: First appears the user name.

Syntax: WhoAmI [--help][--version]

Supplemental Note: Displays the user name of oneself, this instruction is equivalent to execute "id-un" instruction.


--help online Help.

--version Displays version information.



Function Description: Displays the user information of the current login system.

Grammar: Who [-himqsw][--help][--version][am i][record file]

Supplementary note: Implementation of this directive can be informed of the current user login system, the individual implementation of the WHO directive will be listed login account, the use of terminals, login time and from where to log in or use which x monitor.


-h or--heading display header information columns for each field.

-I or-u or--idle display idle time, if the user in the first minute of any action, will be marked as "." Number, if the user has no action for more than 24 hours, then the "old" string is marked.

-M The effect of this parameter is the same as the specified ' Am I ' string.

-Q or--count only displays the account name and total number of the login system.

-S This parameter ignores no processing and is responsible only for resolving compatibility issues with other versions of the WHO directive.

-W or-t or--MESG or--message or--writable displays the user's information status bar.

--help online Help.

--version Displays version information.



Function Description: Displays the user information of the current login system.

Syntax: w [-fhlsuv][user name]

Supplementary note: The implementation of this directive will tell the users who are currently logged into the system and the procedures they are implementing. Separate execution W

Directive displays all users, you can also specify a user name and display only information about a user.


-F turns on or off to show where the user is logged into the system.

-H does not display header information columns for each field.

-L uses the detailed format list, which is a preset value.

-S uses a concise format list, which does not display the user login time, the terminal stage job and the CPU time consumed by the program.

-U ignores the name of the executing program and the information that the program consumes CPU time.

-V Displays version information.


Finger command

The function of the finger command is to query the user's information, usually displaying the user name, home directory, stasis time, logon time, login shell, etc. of a user in the system. If you want to query for user information on a remote computer, you need to follow the user name with "@ hostname", in the format of [username @ host name], but the network host you are querying needs to run the finger daemon.

The general format for this command is:

finger [options] [consumer] [user @ host]

The options in the command have the following meanings:

-S Displays the user's registration name, actual name, terminal name, write status, stagnation time, logon time, and other information.

-L displays information such as the user's home directory, login shell, message status, and the contents of the. Plan,. Project, and. Forward files in the user's home directory, in addition to the information displayed with the-s option.

-P is the same as the-l option except that the. plan file and the. project file are not displayed.

[Example] use the finger command on the local machine.

$ finger XXQ


Directory:/home/xxq Shell:/bin/bash

Last login Thu 1 21:43 (CST) on tty1

No Mail.

No plan.

$ finger

Login Name Tty Idle Login Time Office Phone

Root root *1 Nov 25 09:17



/etc/group file contains all groups

All user names that exist in the/etc/shadow and/etc/passwd systems

Modify the method of the group to which the current user belongs

Usermod or you can modify the/etc/paaawd file directly


Vlock (Virtual Console lock)

Function Description: Lock the virtual terminal.

Syntax: Vlock [-ACHV]

Supplementary note: The implementation of Vlock instructions can be locked virtual terminals, to avoid others to use.


-A or--all locks all terminal-stage jobs, and if you use this parameter in a Full-screen terminal, the keyboard

Switch off the terminal function together.

-C or--current locks the current terminal stage job, which is a preset value.

-H or--help online Help.

-V or--version display version information.



Function Description: Modify user account.

Syntax: Usermod [-lu][-c < remarks >][-d < login directory >][-e < expiration >][-f < buffer days >][-g < group >][-g < group >][-l & lt; account name >][-s][-u] [user account]

Supplemental Note: Usermod can be used to modify the user account settings.


-c< Notes > Modify the user account's memo text.

-D Login Directory > modify the user login directory.

-e< expiry date > change the expiration period of account number.

-f< Buffer days > Modify the number of days after the password expires to close the account.

-g< Group > Modify the group to which the user belongs.

-g< Group > Modify the additional groups to which users belong.

-l< Account name > Modify user account name.

-L LOCK the user's password to invalidate the password.

-S modifies the shell used by the user upon login.

-U modifies the user ID.

-U unlocks password.



Function Description: Delete user account.

Syntax: Userdel [-r][user Account]

Supplemental Note: Userdel can delete the user account and related files. If you do not add a parameter, only the user account is deleted without deleting the associated file.


-F Deletes the user login directory and all files in the directory.



Function Description: User account Setup program.

Syntax: userconf [--addgroup < group >][--adduser < user id>< Group >< user name >][--delgroup < group >][--deluser < user Id>][--help]

Supplementary note: Userconf actually for the linuxconf symbolic connection, provides the graphical interface the operation Way, for the administrator establishes and manages each kind of account number. If you do not add any parameters, that is, enter the graphical interface.


--addgroup< Group > new Group.

--adduser< User id>< Group >< user name > New user account.

--delgroup< Group > Delete Group.

--deluser< user id> Delete user account.

--help display Help.



Function Description: Set up user account.

Syntax: Useradd [-mmnr][-c < remarks >][-d < login directory >][-e < expiration >][-f < buffer days >][-g < group >][-g < group >][-s ][-U] [user account] or useradd-d [-b][-e < expiry >][-f < buffer days >][-g < group >][-g < group >][-s]

Supplemental Note: Useradd can be used to establish user accounts. After the account is built, then use passwd to set the password of the account. and Userdel can delete the account. The account that is created by using the USERADD directive is actually saved in the/etc/passwd text file.


-c< notes > Plus note text. Note text is saved in the Notes field of passwd.

-d< Login Directory > Specify the starting directory for users to log in.

-D change preset value.

-e< Validity period > Specify the expiration date of the account.

-f< buffer days > Specify how many days after the password expires to close the account.

-g< Group > Specify the group to which the user belongs.

-g< Group > Specify the additional group to which the user belongs.

-M automatically establishes the user's login directory.

-M do not automatically create a user's login directory.

-N cancels the establishment of a group in the name of the user.

-R establishes the system account number.

-s Specifies the shell used by the user upon login.

-u specifies the user ID.

Related Article

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: 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.