1.以root身份登录,创建test/test用户
[root@localhost ~]# useradd test
[root@localhost ~]# passwd test
Changing password for user test.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

home下查询到test用户主目录
[root@localhost ~]# cd /home/
[root@localhost home]# ll
总计 12
drwx------ 22 oracle oinstall 4096 01-06 00:21 oracle
drwx------ 4 test test 4096 01-09 18:51 test
userdel删除用户
1.先删除用户
[root@localhost /]# userdel test
[root@localhost /]# cd /home/
[root@localhost home]# ll
总计 12
drwx------ 22 oracle oinstall 4096 01-06 00:21 oracle
drwx------ 4 502 503 4096 01-09 18:51 test
2.再删除主目录
[root@localhost home]# rm -rf test/
[root@localhost home]# ll
总计 8
drwx------ 22 oracle oinstall 4096 01-06 00:21 oracle
更好的方法:直接删除用户及主目录
[root@localhost home]# userdel -r test
[root@localhost home]# ll
总计 8
drwx------ 22 oracle oinstall 4096 01-06 00:21 oracle
当前标题:Linux每日一题——(1)创建和删除用户-创新互联
URL标题:http://scpingwu.com/article/dcjiii.html