如要测试日志功能是否正常
先qmailctl stop停止qmail
然后换到对应目录
cd /service/qmail-smtpd/log
停掉这个目录中的脚本
svc -d .
运行脚本
./run
查看回馈.
如我发现log有问题
[root@centos-qmail ~]# ps -efl | grep "service errors" | grep -v gre
0 S root 364 357 0 80 0 - 957 pipe_w 20:16 ? 00:00:00 readproctitle service errors: ...denied?multilog: fatal: unable to lock directory /var/log/qmail/smtpd: access denied?multilog: fatal: unable to lock directory /var/log/qmail/smtpd: access denied?multilog: fatal: unable to lock directory /var/log/qmail/smtpd: access denied?multilog: fatal: unable to lock directory /var/log/qmail/smtpd: access denied?multilog: fatal: unable to lock directory /var/log/qmail/smtpd: access denied?
说不能锁定
[root@centos-qmail ~]# qmailctl stop
Stopping qmail...
qmail-smtpd
qmail-send
停掉
[root@centos-qmail ~]# cd /service/qmail-smtpd
[root@centos-qmail qmail-smtpd]# svc -d .
[root@centos-qmail qmail-smtpd]# ./run
No /var/qmail/control/rcpthosts!
Refusing to start SMTP listener because it'll create an open relay
测试了一下smtpd管理
竟然检测rcpthosts文件是否存在,不存在直接退出
[root@centos-qmail qmail-smtpd]# ./run
-bash: ./run: Permission denied
把它逻辑改了,只是提示没有这个文件.这个文件只是控制smpt 不能rcpt to:谁的.
删除了就可以所有人
否则得允许一个加一个
[root@centos-qmail qmail-smtpd]# ./run
/usr/local/bin/softlimit -m 10000000 /usr/local/bin/tcpserver -v -R -l centos-qmail.local -x /etc/tcp.smtp.cdb -c 20 -u 503 -g 502 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
tcpserver: status: 0/20
tcpserver: status: 1/20
tcpserver: pid 8409 from 124.254.8.164
tcpserver: ok 8409 centos-qmail.local:124.254.8.171:25 :124.254.8.164::60159
^C
正常运行起来了.
[root@centos-qmail qmail-smtpd]# ./run
No /var/qmail/control/rcpthosts!
Refusing to start SMTP listener because it'll create an open relay
/usr/local/bin/softlimit -m 10000000 /usr/local/bin/tcpserver -v -R -l centos-qmail.local -x /etc/tcp.smtp.cdb -c 20 -u 503 -g 502 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
tcpserver: status: 0/20
^C
测试log
[root@centos-qmail qmail-smtpd]# cd log
[root@centos-qmail log]# svc -d .
[root@centos-qmail log]# ./run
multilog: fatal: unable to lock directory /var/log/qmail/smtpd: access denied
提示不能锁定
看了一下run.得知使用 /var/log/qmail/smtpd
猜了一下.
估计是用户无权.
[root@centos-qmail log]# /usr/local/bin/setuidgid
setuidgid: usage: setuidgid account child
[root@centos-qmail log]# /var/log/qmail/smtpd
-bash: /var/log/qmail/smtpd: is a directory
[root@centos-qmail log]# /var/log/qmail/smtpd/run
-bash: /var/log/qmail/smtpd/run: No such file or directory
[root@centos-qmail log]# ls -l /var/log/qmail/smtpd/
total 0
-rwxr-xr-t. 1 root nofiles 0 Oct 25 16:48 current
-rwxr-xr-t. 1 root nofiles 0 Oct 25 16:48 lock
-rwxr-xr-t. 1 root nofiles 0 Oct 25 16:48 state
查看果然是root,非qmaill
所有
[root@centos-qmail log]# chown --help
Usage: chown [OPTION]... [OWNER][:[GROUP]] FILE...
or: chown [OPTION]... --reference=RFILE FILE...
Change the owner and/or group of each FILE to OWNER and/or GROUP.
With --reference, change the owner and group of each FILE to those of RFILE.
-c, --changes like verbose but report only when a change is made
--dereference affect the referent of each symbolic link (this is
the default), rather than the symbolic link itself
-h, --no-dereference affect each symbolic link instead of any referenced
file (useful only on systems that can change the
ownership of a symlink)
--from=CURRENT_OWNER:CURRENT_GROUP
change the owner and/or group of each file only if
its current owner and/or group match those specified
here. Either may be omitted, in which case a match
is not required for the omitted attribute.
--no-preserve-root do not treat `/' specially (the default)
--preserve-root fail to operate recursively on `/'
-f, --silent, --quiet suppress most error messages
--reference=RFILE use RFILE's owner and group rather than
specifying OWNER:GROUP values
-R, --recursive operate on files and directories recursively
-v, --verbose output a diagnostic for every file processed
The following options modify how a hierarchy is traversed when the -R
option is also specified. If more than one is specified, only the final
one takes effect.
-H if a command line argument is a symbolic link
to a directory, traverse it
-L traverse every symbolic link to a directory
encountered
-P do not traverse any symbolic links (default)
--help display this help and exit
--version output version information and exit
Owner is unchanged if missing. Group is unchanged if missing, but changed
to login group if implied by a `:' following a symbolic OWNER.
OWNER and GROUP may be numeric as well as symbolic.
Examples:
chown root /u Change the owner of /u to "root".
chown root:staff /u Likewise, but also change its group to "staff".
chown -hR root /u Change the owner of /u and subfiles to "root".
Report chown bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'chown invocation'
更改成qmaill所有.
[root@centos-qmail log]# chown -R qmaill /var/log/qmail/smtpd/
[root@centos-qmail log]# ls -l /var/log/qmail/smtpd/
total 0
-rwxr-xr-t. 1 qmaill nofiles 0 Oct 25 16:48 current
-rwxr-xr-t. 1 qmaill nofiles 0 Oct 25 16:48 lock
-rwxr-xr-t. 1 qmaill nofiles 0 Oct 25 16:48 state
再试.ok
[root@centos-qmail log]# ./run
^C
[root@centos-qmail log]# ^C