安全日志:/var/log/secure

/var/log/secure 一般用来记录安全相关的信息,记录最多的是哪些用户登录服务器的相关日志,如果该文件很大,说明有人在破解你的 root 密码

[root@localhost ~]$ tail /var/log/secure
Dec 27 14:04:51 139 sshd[30956]: Disconnecting: Too many authentication failures [preauth]
Dec 27 14:04:53 139 sshd[30968]: Invalid user user from 193.201.224.12 port 26133
Dec 27 14:04:53 139 sshd[30968]: input_userauth_request: invalid user user [preauth]
Dec 27 14:05:01 139 sshd[30968]: Disconnecting: Change of username or service not allowed: (user,ssh-connection) -> (User,ssh-connection) [preauth]
Dec 27 14:05:03 139 sshd[30996]: Invalid user User from 193.201.224.12 port 43273

可以分为几个字段来描述这些事件信息:

  1. 事件的日期和时间
  2. 事件的来源主机 ( 通常是写主机名 )
  3. 产生这个事件的程序[进程号]
  4. 实际的日志信息

常见信息:

Jan 17 12:27:36 139 sshd[12812]: pam_unix(sshd:session): session closed for user root    # 表示root用户关闭了会话(也就是关闭了终端)
Jan 17 12:28:59 139 sshd[14064]: Accepted publickey for root from 14.23.168.10 port 36637 ssh2     # 表示接受来自14.23.168.10的root用户的公钥登录
Jan 17 12:28:59 139 sshd[14064]: pam_unix(sshd:session): session opened for user root by (uid=0) # 表示给root用户打开一个终端
Jan 17 14:41:10 Mir2_Center sshd[9913]: Received disconnect from 183.60.122.237: 11: disconnected by user    # 表示已经连着的终端主动断开连接,并关闭终端
Jan 17 14:41:10 Mir2_Center sshd[9913]: pam_unix(sshd:session): session closed for user root
Jan 17 14:39:48 139 sshd[31261]: Invalid user redis from 45.115.45.3 port 33274                           # 表示对端使用无效的用户redis来连接
Jan 17 14:39:48 139 sshd[31261]: input_userauth_request: invalid user redis [preauth] # 本机对redis用户进行认证,认证失败,发送错误信号给对端
Jan 17 14:39:48 139 sshd[31261]: Received disconnect from 45.115.45.3 port 33274:11: Bye Bye [preauth] # 对端接收到错误信号主动断开连接
Jan 17 14:39:48 139 sshd[31261]: Disconnected from 45.115.45.3 port 33274 [preauth] # 连接关闭
上一篇:sqlalchemy精华版


下一篇:Linux /var/log下的各种日志文件详解