Used for batch processing to create multiple commands at once
newusers command is used for batch processing to create multiple commands at one time.
newusers(parameter)
User file: Specify a text file containing user information. The format of the file must be the same as /etc/passwd
.
Use the newusers command to add users in batches:
The usage is very simple. newusers is directly followed by a file. The file format is the same as /etc/passwd
.
Username 1:x:UID:GID:User description:User's home directory:SHELL used
Example:
jingang0:x:520:520::/home/jingang0:/sbin/nologin
jingang1:x:521:521::/home/jingang1:/sbin/nologin
...
It is worth mentioning that regarding the SHELL type, to view all SHELLs on the host, you can view it through chsh:
[root@localhost beinan]# chsh --list
/bin/sh
/bin/bash
/sbin/nologin
/bin/ksh
/bin/tcsh
/bin/csh
/bin/zsh
Except for /sbin/nologin
, other types of SHELL can log in to the system. Nologin is mostly a SHELL used by virtual users, which means that although he is a system user, he does not have the permission to log in to the system; if you want to add this If you are a user, set his SHELL to /sbin/nologin
, such as the example above.
Regarding the user name, UID, GID and user's home directory, you can read the corresponding reference document.