useradd

 useradd es && echo "es123" | passwd --stdin es

# useradd -m commonuser

# echo 123 | passwd commonuser --stdin

 

useradd nginx -s /sbin/nologin -M

 

groupadd nginx

useradd -g nginx -d /home/nginx nginx

passwd nginx

 

userdel -r test1

 

[root@mvp2 ~]# useradd -m commonuser -p commonuser
[root@mvp2 ~]# userdel -r commonuser

 

 -----------------

groupadd prometheus
#useradd -g prometheus -m -d /home/prometheus -s /sbin/nologin prometheus

useradd -g prometheus -M -s /sbin/nologin prometheus
 
grep "prometheus" /etc/group /etc/gshadow
grep "prometheus" /etc/passwd
 
 
linux-90ii:/home # grep prometheus /etc/passwd
prometheus:x:1001:1000::/home/prometheus:/sbin/nologin
linux-90ii:/home # grep prometheus /etc/group
prometheus:x:1000:

 
SuSE useradd不加组默认加入users组
CentOS 创建用户的时候也创建了组

useradd prometheus -M -s /sbin/nologin  

-M不创建/home/prometheus
 
id prometheus
linux-90ii:/data/app/prometheus # groups prometheus
prometheus : users

-----------------

 

 

 

posted @ 2022-01-03 18:40  tonggc1668  阅读(52)  评论(0编辑  收藏  举报