温馨提示×

怎样监控debian ftpserver

小樊
33
2026-09-28 00:02:33
栏目: 智能运维

在 Debian 上监控 FTP 服务器,通常取决于你使用哪种 FTP 服务端软件(最常见的是 vsftpd、proftpd 或 pure-ftpd)。下面以最常见、默认的 vsftpd 为主,同时补充通用方案。


一、确认 FTP 服务状态

1. 查看服务是否运行

systemctl status vsftpd

或

service vsftpd status

2. 设置开机自启并监控

systemctl enable vsftpd
systemctl start vsftpd

二、查看实时连接与登录情况

1. 查看当前 FTP 连接

netstat -antp | grep :21

或(推荐)

ss -antp | grep :21

2. 查看登录用户

who

(仅对本地用户有效)

3. vsftpd 当前会话

vsftpd 本身不提供 ftpwho,可查看进程:

ps aux | grep vsftpd

三、日志监控(最重要)

1. vsftpd 日志位置

通常在这里:

/var/log/vsftpd.log

或系统日志:

/var/log/syslog

2. 实时查看日志

tail -f /var/log/vsftpd.log

3. 常见监控内容

  • 登录成功 / 失败
  • 上传 / 下载
  • 匿名访问
  • 暴力破解尝试

示例:

CONNECT: Client "192.168.1.10"
LOGIN: Client "192.168.1.10", user "test"
DOWNLOAD: Client "192.168.1.10", "/file.zip"

四、增强安全与监控(推荐)

1. 开启详细日志(vsftpd.conf)

xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
log_ftp_protocol=YES

重启:

systemctl restart vsftpd

2. 防止暴力破解

  • 使用 fail2ban
apt install fail2ban

配置:

/etc/fail2ban/jail.d/vsftpd.conf

3. 限制用户与带宽

max_clients=50
max_per_ip=5
local_max_rate=102400

五、图形化 / 高级监控方案

  • Monitorix(轻量)
  • Zabbix / Prometheus + Node Exporter
  • Netdata(实时流量和连接)

六、如果你用的是其他 FTP 服务

  • ProFTPD
    ftpwho
    
  • Pure-FTPd
    pure-ftpwho
    

如果你能告诉我:

  • 使用的 FTP 软件(vsftpd / proftpd / pure-ftpd)
  • 想要监控什么(连接数 / 安全 / 流量 / 审计)

我可以给你更精确的配置示例。

0 踩