温馨提示×

CentOS FTP 服务器如何限制上传下载速度

小樊
90
2025-02-08 18:04:40
栏目: 云计算
亿速云爆款云服务器,独享5M带宽,BGP线路,安全稳定,0.96元/天! 查看详情>>

在 CentOS 上设置 FTP 服务器并限制上传和下载速度,可以使用 vsftpd(Very Secure FTP Daemon)

  1. 安装 vsftpd:
sudo yum install -y vsftpd
  1. 启动 vsftpd 服务:
sudo systemctl start vsftpd
  1. 设置 vsftpd 服务开机自启:
sudo systemctl enable vsftpd
  1. 编辑 vsftpd 配置文件 /etc/vsftpd/vsftpd.conf
sudo vi /etc/vsftpd/vsftpd.conf
  1. 在配置文件中添加或修改以下选项以限制上传和下载速度:
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
max_clients=10
max_login_attempts=3
local_umask=022
file_open_mode=0644
anon_upload_enable=NO
anon_mkdir_writeable=NO
anon_other_writeable=NO
write_enable=YES
download_enable=YES
local_max_rate=500K
local_max_rate_per_user=500K
  • local_max_ratelocal_max_rate_per_user 分别限制本地用户和每个用户的上传速度。例如,将其设置为 500K 表示限制上传速度为 500 KB/s。
  • 如果需要限制下载速度,可以添加 download_enable=YES 并在配置文件中添加类似的选项,例如 local_max_rate_per_user=500K
  1. 保存并退出配置文件。

  2. 重启 vsftpd 服务以应用更改:

sudo systemctl restart vsftpd

现在,您的 CentOS FTP 服务器已经设置了上传和下载速度限制。请注意,这些限制适用于本地用户,如果您需要为远程用户提供速度限制,可以考虑使用其他 FTP 服务器软件,如 ProFTPD。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:centos ftpserver文件上传下载

0