|
chfn 命令可以用来更新用户的相关信息,它的用法如下:chfn [-f full_name] [-r room_no] [-w work_ph] [-h home_ph] [-o other] [user]
chfn 可以用来更新用户的 “完整名字”(对应于 -f 选项),"办公室房间号码“(对应于 -r 选项),”办公室电话号码“(对应于 -w 选项), 家里的电话号码”(对应于 -h 选项) 。
在默认情况下,普通用户无法自己更改自己的“完整名字”。这个限定和 /etc/login.def 有关:#
# Which fields may be changed by regular users using chfn - use
# any combination of letters "frwh" (full name, room number, work
# phone, home phone). If not defined, no changes are allowed.
# For backward compatibility, "yes" = "rwh" and "no" = "frwh".
#
CHFN_RESTRICT rwh 如上,可以将 CHFN_RESTRICT 设置为 frwh ,即可允许普通用户设置自己的”全名“
在不带任何参数的情况下执行 chfn ,它会以一种向导的方式引导你去完成所有选项的设定;否则可以显示的在命令行中使用 f, r, w, h 来指定。如果你之前已经设置过相应的选项,那么旧有的记录会保存在 [ ] 中,如:beyes@debian:~$ chfn
Password:
Changing the user information for beyes
Enter the new value, or press ENTER for the default
Full Name: beyes
Room Number [206]: 在设置完后,你可以发现 /etc/passwd 文件也得到了更新:$cat /etc/passwd
...
beyes:x:1000:1000:beyes,206,26563288,63230688:/home/beyes:/bin/bash 上面,beyes,206,26563288,63230688 这一部分信息为刚才用 chnf 所设置,它们之间彼此用逗号隔开。
另外,超级用户还可以使用 -o 选项来设置 GECOS 域中未定义的部分。该部分属于 /etc/passwd , passwd 文件的格式为:account:password:UID:GID:GECOS:directory:shell GECOS 是 General Electric Comprehensive Operating System ,即通用电气公司综合操作系统的缩写,对于这个名字倒是无需深究,具体描述 man passwd 中的说明。
另外,这些信息都可以被finger 命令读出。但 finger 命令不是很安全,可能会无形中泄露掉一些关键信息,所以一般情况下系统不会默认安装。 |
|