3

Linux常用命令-43:useradd

 1 year ago
source link: https://xugaoxiang.com/2022/06/13/linux-cmds-43-useradd/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

useradd 命令用来创建新的用户或更改用户的信息。创建的帐号,保存在 /etc/passwd 文件中。

语法格式:useradd [参数] [用户名]

常用参数:

146edee023749381.png
# 创建新的账号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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK