在 Ubuntu 下使用 SFTP 断点续传,常见有几种方式,取决于你用的是命令行 sftp、lftp,还是图形化工具。
lftp(最推荐,原生支持断点续传)lftp 的 sftp 协议支持自动断点续传。
sudo apt update
sudo apt install lftp
lftp sftp://user@host
输入密码后进入。
put -c localfile
-c 表示 continue(续传)
get -c remotefile
mirror -c /remote/path /local/path
✅ 优点:网络中断后重连可继续传
❌ 需额外安装软件
sftp(有限支持)Ubuntu 默认的 sftp 命令本身不支持自动断点续传,但可手动实现。
reget / reputsftp user@host
sftp> ls -l remotefile
sftp> reget remotefile
sftp> put -a localfile
或
sftp> reput localfile
⚠️ 注意:
reget / reput 依赖服务器支持rsync over SSH(强烈推荐替代方案)虽然不是纯 SFTP,但最稳定、最常用。
rsync -P -e ssh localfile user@host:/remote/path/
-P = 显示进度 + 断点续传✅ 支持大文件
✅ 自动校验
✅ 服务器只需开 SSH
传输 → 断点续传 → 总是sftp://user@host
| 场景 | 推荐方式 |
|---|---|
| 命令行稳定续传 | lftp 或 rsync |
| 系统自带工具 | sftp + reget/reput |
| 桌面用户 | FileZilla |
| 大文件/服务器同步 | rsync -P |
如果你愿意告诉我:
我可以给你最合适的具体命令。