在 CentOS 上,SFTP 本身没有独立的日志文件,它通常由 SSH 服务(sshd) 记录日志。常见查看方式如下:
cat /var/log/secure
journalctl -u sshd
或实时查看:
journalctl -u sshd -f
也可以直接搜索 sftp:
grep sftp /var/log/secure
# 或
journalctl -u sshd | grep sftp
Accepted password for user from 192.168.1.100 port 54321 ssh2
subsystem request for sftp
编辑:
vi /etc/ssh/sshd_config
确认有类似:
Subsystem sftp internal-sftp
internal-sftp 的日志记录更完整。
修改后重启:
systemctl restart sshd
在 sshd_config 中添加:
LogLevel VERBOSE
然后:
systemctl restart sshd
这样能看到更多操作细节(如文件传输)。
那是另一套:
/var/log/vsftpd.log
如果你能说明:
我可以给你更精确的命令。