Answers:
请张贴您的sshd_config
其他内容似乎已更新。一个库存的CentOS系统总是登录到/var/log/secure
。
$ sudo tail -f /var/log/secure
Feb 18 23:23:34 greeneggs sshd[3545]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Feb 18 23:23:36 greeneggs sshd[3545]: Failed password for root from ::1 port 46401 ssh2
Feb 18 23:23:42 greeneggs unix_chkpwd[3555]: password check failed for user (root)
Feb 18 23:23:42 greeneggs sshd[3545]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Feb 18 23:23:43 greeneggs sshd[3545]: Failed password for root from ::1 port 46401 ssh2
Feb 18 23:23:48 greeneggs sshd[3545]: Accepted password for root from ::1 port 46401 ssh2
Feb 18 23:23:48 greeneggs sshd[3545]: pam_unix(sshd:session): session opened for user root by (uid=0)
Feb 18 23:24:05 greeneggs sshd[3545]: Received disconnect from ::1: 11: disconnected by user
Feb 18 23:24:05 greeneggs sshd[3545]: pam_unix(sshd:session): session closed for user root
Feb 18 23:27:15 greeneggs sudo: saml : TTY=pts/3 ; PWD=/home/saml ; USER=root ; COMMAND=/bin/tail /var/log/secure
通过/etc/ssh/sshd_config
以下方式控制:
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO
以及以下内容/etc/rsyslog.conf
:
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
在您的评论之一中,您提到您的rsyslogd
配置文件名为/etc/rsyslog.config
。这不是该文件的正确名称,很可能是您的日志记录被搞砸的原因。将此文件的名称更改为/etc/rsyslog.conf
,然后重新启动日志记录服务。
$ sudo service rsyslog restart
sshd
可执行文件的源代码中。如果要覆盖默认值,则可以提供sshd
命令行选项或编辑其配置文件。
ssh
被编译LogLevel
为INFO
默认设置。要改写它,您需要取消注释该行,然后更改其值。
默认的sshd
syslog工具为AUTH
,因此它将在syslog中登录到/var/log/messages
。
要将sshd
日志记录到新文件,可以将其syslog工具更改为其他名称,然后配置syslog以将此新工具记录到新文件,即:
在sshd_config中,添加以下行:
SyslogFacility AUTHPRIV
然后在syslog.conf中:
authpriv.* /var/log/secure
SyslogFacility AUTHPRIV
在RH发行版中已经是默认设置。他们将其作为包装的一部分覆盖。
/etc/rsyslog.config
为/etc/rsyslog.conf
。
/var/log/message
是真的位置吗?一般/var/log/messages
。