Debian系统SFTP日志分析方法如下:
/var/log/auth.log
中。tail -f /var/log/auth.log | grep sftp
。grep 'sftp' /var/log/auth.log
。Accepted password for user from IP port ssh2
。Failed password for user from IP port ssh2
。channel_open_session: session 1: sftp
表示SFTP会话开始。awk
/sed
:提取特定字段(如时间、IP、用户名)。logwatch
:定期生成日志分析报告。logrotate
自动压缩归档旧日志,避免文件过大。fail2ban
识别暴力破解尝试。journalctl -u sshd.service
查看系统级SSH/SFTP日志。注:部分场景需调整/etc/ssh/sshd_config
中LogLevel
参数(如设为VERBOSE
)获取更详细日志。