用 rclone 来挂载 FTP,适合在 Debian 12 VPS 上长期使用,让 FTP 看起来像一块本地磁盘。
一、安装 rclone
apt update
apt install rclone -y
二、配置 FTP 连接
rclone config
然后根据提示操作:
n) New remote
s) Set configuration password
q) Quit config
输入:n
接着给远程存储起个名字,例如:
name> myftp
选择存储类型:
Storage> ftp
然后按提示填写:
host> ftp.example.com
user> ftp用户名
port> 21
pass> ftp密码
其他选项保持默认,一路回车到最后输入:y
退出:q
三、测试连接
执行:
rclone ls myftp:
若能列出文件列表,就说明 FTP 配置成功了
四、挂载为 VPS 本地磁盘
创建挂载目录:
mkdir -p /mnt/ftp
挂载命令:
rclone mount myftp: /mnt/ftp --allow-other --vfs-cache-mode writes
此时 /mnt/ftp 就像本地磁盘一样能访问 FTP 内容。
(按下 Ctrl + C 会卸载)
五、后台挂载(长期运行)
如果要让它在后台运行:
nohup rclone mount myftp: /mnt/ftp --allow-other --vfs-cache-mode writes &
或者创建 systemd 服务,让系统启动时自动挂载
六、创建 systemd 启动服务
nano /etc/systemd/system/rclone-ftp.service
内容如下(改成你的配置名和挂载目录):
[Unit]
Description=Mount FTP using rclone
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/rclone mount myftp: /mnt/ftp \
--allow-other \
--vfs-cache-mode writes \
--dir-cache-time 12h \
--vfs-read-chunk-size 128M \
--vfs-read-chunk-size-limit 2G
Restart=on-failure
[Install]
WantedBy=multi-user.target
保存并退出。
七、启用与启动服务
systemctl daemon-reload
systemctl enable rclone-ftp
systemctl start rclone-ftp
查看状态:
systemctl status rclone-ftp
看到 “Active: active (running)” 就代表挂载成功了
八、卸载挂载
如果想手动卸载:
fusermount -u /mnt/ftp



没有回复内容