The useradd
command is used to create a new user or change user information. The created account is saved in the /etc/passwd
file.
Syntax format: useradd [parameter] [username]
Common parameters:
Example
# 创建新的账号xugaoxiang useradd xugaoxiang # 创建账号,但不创建其HOME目录,也就是/home/xugaoxiang,同时禁止登录useradd -M -s /sbin/nologin xugaoxiang添加新用户,指定UID为666,指定用户组为root,toor成员,指定shell类型为/bin/sh # useradd -u 666 -s /bin/sh -G root,toor xugaoxiang
This article is reprinted from https://xugaoxiang.com/2022/06/13/linux-cmds-43-useradd/
This site is for inclusion only, and the copyright belongs to the original author.