CentOS7 上的 PAM 标准宏和日志记录
PAM standard macros and logging on CentOS7
根据pam_macros.h
中定义的D(x)
宏(source code),使用如下:
D(("Hello PAM World"));
此日志位于 CentOS7
的什么地方?
请注意,我在 pam.d
配置文件中使用了标志 debug
。
我还尝试了以下命令:
grep -rnw '/var/log/' -e "Hello Pam World"
但是没有成功。
在您 link 的文件中,顶部有这些行:
/*
* This is for debugging purposes ONLY. DO NOT use on live systems !!!
* You have been warned :-) - CG
*
* to get automated debugging to the log file, it must be created manually.
* _PAM_LOGFILE must exist, mode 666
*/
#ifndef _PAM_LOGFILE
#define _PAM_LOGFILE "/tmp/pam-debug.log"
#endif
所以看起来输出将定向到 /tmp/pam-debug.log
,但您必须先创建它,并赋予它完整的读写权限:
$ touch /tmp/pam-debug.log
$ chmod 666 /tmp/pam-debug.log
查看此文件的 Linux 版本,它看起来像是写入 /var/run/pam-debug.log
,但前提是它是用 PAM_DEBUG
.
编译的
在configure.ac
中有一个很好的评论:
if test x"$enable_debug" = x"yes" ; then
AC_DEFINE([PAM_DEBUG],,
[lots of stuff gets written to /var/run/pam-debug.log])
根据pam_macros.h
中定义的D(x)
宏(source code),使用如下:
D(("Hello PAM World"));
此日志位于 CentOS7
的什么地方?
请注意,我在 pam.d
配置文件中使用了标志 debug
。
我还尝试了以下命令:
grep -rnw '/var/log/' -e "Hello Pam World"
但是没有成功。
在您 link 的文件中,顶部有这些行:
/*
* This is for debugging purposes ONLY. DO NOT use on live systems !!!
* You have been warned :-) - CG
*
* to get automated debugging to the log file, it must be created manually.
* _PAM_LOGFILE must exist, mode 666
*/
#ifndef _PAM_LOGFILE
#define _PAM_LOGFILE "/tmp/pam-debug.log"
#endif
所以看起来输出将定向到 /tmp/pam-debug.log
,但您必须先创建它,并赋予它完整的读写权限:
$ touch /tmp/pam-debug.log
$ chmod 666 /tmp/pam-debug.log
查看此文件的 Linux 版本,它看起来像是写入 /var/run/pam-debug.log
,但前提是它是用 PAM_DEBUG
.
在configure.ac
中有一个很好的评论:
if test x"$enable_debug" = x"yes" ; then
AC_DEFINE([PAM_DEBUG],,
[lots of stuff gets written to /var/run/pam-debug.log])