在 CentOS 上 SFTP 传输速度慢,通常不是 SFTP 本身的问题,而是底层网络、SSH、磁盘或配置导致的。下面按最常见原因 → 排查方法 → 解决建议来说明。
SFTP 基于 SSH,所有数据都加密
排查:
top
传输时看 %CPU 是否接近 100%
解决:
sftp -o Ciphers=aes128-gcm@openssh.com ...
/etc/ssh/sshd_config:Ciphers aes128-gcm@openssh.com,aes256-gcm@openssh.com
排查:
ping 目标IP
mtr 目标IP
iperf3 -s / -c
解决:
iperf3 测纯网络速度SFTP 写文件受磁盘速度限制
排查:
iostat -x 1
看 %util 是否 100%
解决:
每个文件都有:
解决:
tar czf file.tar.gz dir/
rsync:rsync -avz dir/ user@host:/path/
以下配置会拖慢速度:
UseDNS yesGSSAPIAuthentication yes优化 /etc/ssh/sshd_config:
UseDNS no
GSSAPIAuthentication no
重启:
systemctl restart sshd
排查:
getenforce
systemctl status firewalld
iperf3 -c 目标IP
scp bigfile user@host:/tmp/
dd if=/dev/zero of=/tmp/test bs=1M count=1000
你可以告诉我:
我可以直接给你针对性的优化方案。