在 Linux 下使用 SFTP 实现断点续传,要看你用的是什么客户端工具。下面按常见情况说明:
sftp 命令(最常见)OpenSSH 的 sftp 本身不支持断点续传(resume)
如果你传输中断,再次 put 会从头开始或覆盖文件。
reput(部分版本支持)某些 OpenSSH 版本支持:
sftp user@host
sftp> reput bigfile.iso
reput:断点续传上传reget:断点续传下载⚠️ 注意:
rsync(最稳妥)rsync -P -e ssh bigfile.iso user@host:/remote/path/
参数说明:
-P:显示进度 + 支持断点续传-e ssh:通过 SSH 传输✅ 优点:
lftp(功能最强)# CentOS / RHEL
yum install lftp
# Ubuntu / Debian
apt install lftp
lftp sftp://user@host
lftp> put -c bigfile.iso
lftp> get -c bigfile.iso
-c:continue(断点续传)| 工具 | 是否支持断点续传 | 推荐度 |
|---|---|---|
| sftp (put/get) | ❌ | ⭐ |
| sftp (reput/reget) | ✅(有限) | ⭐⭐⭐ |
| rsync | ✅✅✅ | ⭐⭐⭐⭐⭐ |
| lftp | ✅✅✅ | ⭐⭐⭐⭐ |
rsync -Prsync 或 lftplftp如果你愿意,我可以给你写一个自动重连 + 断点续传脚本。