FreeBSD handbook中文版 8 用户和基本的帐户管理( 三 )


Uid: 1007
Gid: 1007 (jru)
Class:
Groups: jru wheel
HOME: /home/jru
Shell: /usr/local/bin/tcsh
OK? (y/n) [y]: y
Added user “jru”
Copy files from /usr/share/skel to /home/jru
Add another user? (y/n) [y]: n
Goodbye!
#
总的来讲,我们把默认的shell 设置成tcsh,关闭欢迎邮件 。然后,保存配置,接着创
建一个jru 的帐户,并且确信jru 在wheel 组里面 。
注意:你输入的口令是不会显示出来的,而只会显示星号 。确保输入两次密码时,不
第5 页FreeBSD 使用手册
要输错 。从现在起,只要使用adduser,你不必改变默认设置 。如果程序要求你改变默认设
置,先退出程序,然后执行程序时加上-s 选项 。
8.6.2 rmuser
rmuser 能从系统中删除用户,包括超越用户数据库的任何线索 。rmuser 执行下面的步
骤:
1, 删除用户的crontab 记录
2, 删除属于用户的at 工作
3, 杀掉所有属于用户的所有线程
4, 删除本地密码文件中的用户
5, 删除用户的主目录
6, 删除来自/var/mail 的属于用户的邮件
7, 删除所有诸如/tmp 的临时文件存储区中的文件
8, 最后,删除在/etc/group 中所有属于组的用户名
注意:如果一个组变成空,而组名和用户名一样,组将被删除;rmuser 不能用
来删除超级用户的帐户 。
例8-2. rmuser interactive account removal
# rmuser jru
Matching password entry:
jru:*:1000:1000::0:0:J. Random User:/home/jru:/usr/local/bin/tcsh
Is this the entry you wish to remove? y
Remove user"s home directory (/home/jru)? y
Updating password file, updating databases, done.
Updating group file: trusted (removing group jru—personal group is empty) done.
Removing user"s incoming mail file /var/mail/jru: done.
Removing files belonging to jru from /tmp: done.
Removing files belonging to jru from /var/tmp: done.
Removing files belonging to jru from /var/tmp/vi.recover: done.
#
第6 页FreeBSD 使用手册
8.6.3 pw
Pw 是一个用来创建,删除,修改,显示用户和组的命令行工具,它还有系统用户和组
文件编辑器的功能 。Pw 有一个非常强大的命令行设置选项,但新用户可能会觉得它比这儿
讲的其它命令要复杂得多 。
8.6.4 chpass
Chpass 可以改变用户的密码,shells,和个人信息的数据库信息 。只有超级用户才能改
变其它用户的信息 。除了可选择的用户名,不需要任何选项,chpass 显示一个包含用户信息
的编辑器,而且可以试图改变在用户数据库中的信息 。
例如8-3. Interactive chpass by Superuser
#Changing user database information for jru.
Login: jru
Password: *
Uid [#]: 1000
Gid [# or name]: 1000
Change [month day year]:
Expire [month day year]:
Class:
Home directory: /home/jru
Shell: /usr/local/bin/tcsh
Full Name: J. Random User
Office Location:
Office Phone:
Home Phone:
Other information:
The normal user can change only a small subsection of this information, and only for
themselves.
例如8-4. Interactive chpass by Normal User
#Changing user database information for jru.
Shell: /usr/local/bin/tcsh
第7 页FreeBSD 使用手册
Full Name: J. Random User
Office Location:
Office Phone:
Home Phone:
Other information:
8.6.5 passwd
passwd 是改变你自己的密码的常用方法 。
注意:在改变密码前用户必须键入原来的密码 。当使用者离开他们的控制台时,可以阻
止一个没有经过认证的人改变他们的密码 。
例如8-5. passwd
% passwd
Changing local password for jru.
Old password:
New password:
Retype new password:
passwd: updating the database...
passwd: done
# passwd jru
Changing local password for jru.
New password:
Retype new password:
passwd: updating the database...

推荐阅读