系统管理 useradd userdel

userdel -r 和userdel的区别:

userdel删除用户不删除家目录;userdel -r 删除家目录并删除用户

[root@localhost ~]# useradd jin

[root@localhost ~]# userdel  jin

[root@localhost ~]# grep bash /etc/passwd

root:x:0:0:root:/root:/bin/bash

[root@localhost ~]# ls /home/

jin

[root@localhost ~]# useradd  jin1

[root@localhost ~]# userdel -r   jin1

[root@localhost ~]# ls /home/

jin

创建系统用户并不可登录

[root@localhost ~]# useradd -s /sbin/nologin -M nginx1

[root@localhost ~]# grep nginx1 /etc/passwd

nginx1:x:1000:1000::/home/nginx1:/sbin/nologin

你可能感兴趣的:(linux,运维,服务器)