在 Linux 上查看 FTP 服务器日志,取决于你使用的是哪种 FTP 服务软件。常见的是 vsftpd、ProFTPD、Pure-FTPd。下面分别说明。
vsftpd 日志通常在:
/var/log/vsftpd.log
或(部分系统):
/var/log/messages
/var/log/syslog
cat /var/log/vsftpd.log
tail -f /var/log/vsftpd.log
grep "USER" /var/log/vsftpd.log
查看配置文件:
grep -E "xferlog|log" /etc/vsftpd.conf
常见相关配置:
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
log_ftp_protocol=YES # 详细日志(调试用)
修改后重启:
systemctl restart vsftpd
常见路径:
/var/log/proftpd/access.log
/var/log/proftpd/auth.log
或:
/var/log/messages
tail -f /var/log/proftpd/access.log
/etc/proftpd/proftpd.conf
相关配置:
TransferLog /var/log/proftpd/access.log
SystemLog /var/log/proftpd/auth.log
Pure-FTPd 默认通常写入系统日志:
/var/log/messages
/var/log/syslog
查看:
grep pure-ftpd /var/log/messages
grep pure-ftpd /var/log/syslog
启动时加参数:
pure-ftpd -d
或配置:
/etc/pure-ftpd/conf/VerboseLog
journalctl -u vsftpd
journalctl -u proftpd
或:
dmesg | grep ftp
ps -ef | grep ftp
netstat -antp | grep :21
ss -antp | grep :21
ps -ef | grep ftp
或:
systemctl status vsftpd
systemctl status proftpd
如果你愿意,可以告诉我:
我可以给你更精确的命令。