FreeBSD 研习课程讲义
Prev 增删使用者帐号 Next

增删使用者帐号
⊙增加帐号:
在shell提示符号后
执行 adduser  这个指令
duncan@ -root- [~]# adduser

就会出现以下的讯息

出现新增使用者的设定档设定询问
/etc/adduser.conf: No such file or directory
Use option ``-silent'' if you don't want to see all warnings and questions.

Check /etc/shells
Check /etc/master.passwd
Check /etc/group
Usernames must match regular expression:
[^[a-z0-9_][a-z0-9_-]*$]:
Enter your default shell: bash csh date no sh tcsh [sh]: bash
Your default shell is: bash -> /usr/local/bin/bash
Enter your default HOME partition: [/home]:
Copy dotfiles from: /usr/share/skel no [/usr/share/skel]:
Send message from file: /etc/adduser.message no
[/etc/adduser.message]:
Use passwords (y/n) [y]:

Write your configuration to /etc/adduser.conf? (y/n) [y]:  #写入预设的新增使用者设定档(输入y)

Ok, let's go.
Don't worry about mistakes. I will give you the chance later to correct any input.
Username: yuan                                            #帐号名称
Full name:                                                #全名
Uid (Leave empty for default):                            #帐号的UID
Login group [yuan]:                                       #帐号的群组 (若需转为root,需设为wheel群组)
Login group is yuan. Invite yuan into other groups? []:   #帐号的另一个群组
Login class [default]:
Shell (sh csh tcsh bash) [sh]: bash                       #使用的shell
Home directory [/home/yuan]:                              #使用者的家目录
Use password-based authentication? [yes]:                 
Use an empty password? (yes/no) [no]:                    
Use a random password? (yes/no) [no]:
Enter password:                                           #输入密码                                         
Enter password again:
Lock out the account after creation? [no]:

下面是让您确认输入的资料是否正确
Username   : yuan
Password   : *****
Full Name  :
Uid        : 1003
Class      :
Groups     : yuan
Home       : /home/yuan
Shell      : /usr/local/bin/bash
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (yuan) to the user database.

这样就建立一个新的帐号。只有少部分需注意的设定外,大部分都用预设的就行。


⊙删除帐号
 
新增了使用者之后,就必须要了解如何删除使用者。
1.删除帐号


Duncan@ -root- [~]# rmuser                                 #请以root的身分,执行 rmuser 这个命令。
Enter login name for user to remove: kidd              #询问欲删除的使用者帐号?(输入帐号)
Matching password entry:

kidd:xE70S/icGF6JA:1219:1219::0:0:robinson:/home/kidd:/usr/local/bin/bash   # 显示系统符合的帐号!
Is this the entry you wish to remove? yes               #询问是否要将符合的帐号删除?(y/yes)
Remove user's home directory (/home/kidd)? yes      #询问是否要将该帐号的使用者家目录删除?(y/yes)
Updating password file, updating databases, done.       # 显示执行状况,并将所属於该帐号的邮件及档案资料删除。 
Updating group file: (removing group robinson -- personal group is empty) done.
Removing user's home directory (/home/kidd): done.
Removing files belonging to kidd from /tmp: done.
Removing files belonging to kidd from /var/tmp: done.
Removing files belonging to kidd from /var/tmp/vi.recover: done.
 
2.快速删除帐号 若每删一个帐号还要回答这麽多问题,还是挺慢的。
rmuser -y 帐号名 ( 自动回应y/yes ) 这样要删除一个帐号就简单多了。
 
ex: rmuser -y  kidd


⊙大量转档建帐号

ohaha学习心得-大量转档建帐号篇


Prev Home Next
/etc 目录档案概述 UP 安装软体方式介绍