添加用户:

[root@localhost ~]# useradd test

[root@localhost~]#passwdtest

Changingpasswordforusertest.

New UNIX password:

Retype new UNIX password:

passwd:allauthenticationtokensupdatedsuccessfully.

此时,该用户才是可以使用的。

设置的默认规则如下:

[root@localhost~]#useradd-D

GROUP=100

HOME=/home

INACTIVE=-1

EXPIRE=

SHELL=/bin/bash

SKEL=/etc/skel

CREATE_MAIL_SPOOL=no

删除用户:

[root@localhost ~]# userdel test [root@localhost ~]# userdel -r test

注:可以用userdel 来删除test用户,我们看到第二个例子中多了一个参数-r ,第一个例子是说只删除test用户,其家目录和mail等仍会保存;加上-r 参数,是删除家目录及mail等;所以要小心操作;用userdel 删除用户的同时,也会把其用户组删除;

参考资料:

http://hi.baidu.com/vincent_1984/blog/item/42f83451c34ca5898c5430ff.html

http://blog.chinaunix.net/u1/36131/showart_382813.html