让我们把它和新用户收到的信息比较一下;我使用mail命令该用户的邮件信息:
login: dlavigne
Password:
You have mail.
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/dlavigne": 1 message 1 new
>N 1 genisis Sat Dec 30 12:24 20/540 "Welcome"
& 1
Message 1:
From genisis Sat Dec 30 12:24:19 2000
Date: Sat, 30 Dec 2000 12:24:19 -0500 (EST)
From: User Genisis
To: dlavigne
Subject: Welcome
Dru Lavigne,
your account "dlavigne" was created.
Have fun!
See also chpass(1), finger(1), passwd(1)
& ^D Saved 1 message in mbox
> ^D exit
你可以看到我在成为超级用户以便使用adduser命令这前是以用户“genisis”登录的。我的新用户收到的信息就是adduser.message中包含的内容,而插入的$fullname和$name变量都以实际的值作了替换。
当建立了账号时,我们会得到以下的选项:
Add anything to default message (y/n) [n]:
如果我要建立其它账号并打入y,我会得到以下提示:
Use "." or ^D alone on a file to finish your message
我打入的内容都会被加入到缺省的信息中,然后发给该特定的用户;但是,这不会覆盖我原先创建的/etc/adduser.message文件。让我们来试一下这样做;我将添加一个称为“test”的账号,显示我们关心的输出并“剪掉”其余的:
adduser
<剪掉>
Add anything to default message (y/n) [n]: y
Use "." or ^D alone on a line to finish your message.
Don‘t forget that every Friday is pizza day!
.
Send message (y/n) [y]: y
现在让我们看一下用户test的邮件信息是什么样的:
login: test
Password:
You have mail.
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/test": 1 message 1 new
>N 1 genisis Sat Dec 30 12:47 22/567 "Welcome"
& 1
Message 1:
From genisis Sat Dec 30 12:47:07 2000
Date: Sat, 30 Dec 2000 12:47:07 -0500 (EST)
From: User Genisis
To: test
Subject: Welcome
test,
your account "test" was created.
Have fun!
See also chpass(1), finger(1), passwd(1)
Don‘t forget that every Friday is pizza day!
再看一下新信息是否被加到了模板文件:
more /etc/adduser.message
#
# Message file for adduser(8)
# comment: "#"
# default variables: $name, $fullname, $password
# other variables: see /etc/adduser.conf after
# line "## DO NOT DELETE THIS LINE!"
#
$fullname,
your account "$name" was created.
Have fun!
See also chpass(1), finger(1), passwd(1)
看来只有该用户收到了附加的信息,这正如我们所期望的。在离开adduser.message文件之前我还想做更多的例子。我想让用户在他们的欢迎邮件中收到下面这条附加信息:
If you have any problems, contact the administrator at admin@thiscompany.com
试一下你自己建立一个账号并把这行加到他们的信息中;你会看到当你以该用户登录时,附加行没有出现在邮件信息中。但是如果你把这行改成:
If you have any problems, contact the administrator at admin\@thiscompany.com
那么用户就会收到附加信息了。注意,我们必须用\符号避开@符号,以便正确解释。
最后,让我们看一下刚才建立的adduser.conf文件:
more /etc/adduser.conf
# /etc/adduser.conf - automatic generated by adduser(8)
#
# Note: adduser read *and* write this file
# You may change values, but don‘t add new things before the
# line "## DO NOT DELETE THIS LINE!"
# use password for new users
# defaultpasswd = yes | no
defaultpasswd = yes
# copy dotfiles from this dir ("/usr/share/skel" or "no")
dotdir = "/usr/share/skel"
# send this file to new user
# ("/etc/adduser.message" or "no")
send_message = "/etc/adduser.message"
# config file for adduser ("/etc/adduser.conf")
config = "/etc/adduser.conf"
# logfile ("/var/log/adduser" or "no")
logfile = "/var/log/adduser"
# default HOME directory ("/home")
home = "/home"
# List of directories where shells located
# path = (‘/bin‘, ‘/usr/bin‘, ‘/usr/local/bin‘)
path = (‘/bin‘, ‘/usr/bin‘, ‘/usr/local/bin‘)
# common shell list, first element has higher priority
# shellpref = (‘bash‘, ‘tcsh‘, ‘ksh‘, ‘csh‘, ‘sh‘)
shellpref = (‘csh‘, ‘sh‘, ‘bash‘, ‘tcsh‘, ‘ksh‘, ‘no‘, ‘date‘)
# defaultshell if not empty ("bash")
defaultshell = "tcsh"
# defaultgroup (‘USER‘ for same as
# username or any other valid group)
defaultgroup = USER
# defaultclass if not empty
defaultclass = ""
# new users get this uid (1000)
uid_start = "1000"
## DO NOT DELETE THIS LINE!
## your own variables, see /etc/adduser.message
## end
你可以看到这是个简单的文件,它包含了对adduser工具提示问题的回答。你看到的新信息只是该文件含有adduser记录文件的存放位置。如果看一下这个记录文件,会看到建立账号时的记录:
more /var/log/adduser
2000/12/30 12:24:18 dlavigne:*:1000:1000(dlavigne):Dru Lavigne
2000/12/30 12:47:06 test:*:1001:1001(test):test
Read more from FreeBSD Basics.
分页: [1] [2]
- 上一篇:flash制作动火焰动画
- 下一篇:分析在FreeBSD中添加用户操作过程