Article Title: how to add a new system user in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
[Syntax] adduser [required parameters] [selective parameters] User Name
[Function description] The adduser command adds users to the system based on the command line parameters. Its configuration information is saved in the/etc/adduser. conf file. If the "-- system" or "-- group" parameter is not specified during the call, the adduser command will add a general user by default. To add a system user, use the "-- symtem" parameter. To add a user group, use the "-- group" parameter.
[Parameter description]
The required parameters are described as follows:
Parameter Functions
-R | -- system creates a system user
-- No-creat-home does not create the user's/home directory, even if it does not exist
-Q | -- quiet only displays warning information and error information, not general information
-- Debug for debugging
The optional parameters are described as follows:
Parameter Functions
-D | -- home <目录> Specify the directory as the user's home directory
-S | -- shell |-s uses the specified SHELL as the user's shell for logon.
-U | -- uid <用户id> Use the specified user ID as the user ID instead of the Default User ID.
-- Firstuid <用户id> The specified first user ID does not need to be crossed.
-- Lastid <用户id> You do not need to cross the specified Last User ID
-Group <用户组> When a user is created, the user is assigned to the specified user group.
-- Disabled-password: the password is not set. You can log on
-- Disable-login does not set a password, but the user cannot log on until the password has been set
-- Ingroup <用户组> Add a user to a specified user group instead of creating a user group.
-- Add_extra_groups: adds the user to the additional user group specified by addr. conf.
-- Help |-h help information
-- Version
-- Conf <文件> Replace/etc/. adduser. conf with the specified file
-P | -- password <密码> Unadded user-specified encrypted password
[Parameter usage instructions]
-R | -- system: indicates "-r" or "-- system ".
-- Home <目录> : Add a directory after the "-- home" parameter, not <目录> The two words with Angle brackets are actually directory paths.
[Execution example]
[Example 1] Add a common user.
Root @ localhost :~ # Useradd kk // Add User kk
[Example 2] specify a user group for the added user.
Root @ localhost :~ # Useradd-g root kk // Add User kk and specify the user group as the root user group
[Example 3] Create a system user.
Root @ localhost :~ # Useradd-r kk // create a system user kk
Example 4: Specify the home directory for the newly added user.
Root @ localhost :~ # Useradd-d/home/myf kk // Add User kk, whose home directory is/home/myf
When you log on to the host with the user name kk, the default system directory is/home/myf.
[Related commands]
Deluser, groupadd, usermod