rclone

in Technique with 0 comment and 488 read

Windows 端

下载安装

配置

rclone config

挂载

rclone mount drive_name:/ N: --cache-dir D:\Temp --vfs-cache-mode writes

后端运行以及开机自动挂载

Option Explicit
Dim WMIService, Process, Processes, Flag, WS
Set WMIService = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set Processes = WMIService.ExecQuery("select * from win32_process")
Flag = true
for each Process in Processes
    if strcomp(Process.name, "rclone.exe") = 0 then
Flag = false
exit for
    end if
next
Set WMIService = nothing
if Flag then
    Set WS = Wscript.CreateObject("Wscript.Shell")
    WS.Run "rclone mount drive_name:/ N: --cache-dir D:\Temp --vfs-cache-mode writes", 0
 end if
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Linux端

安装

curl https://rclone.org/install.sh | sudo bash

配置

{"access_token":"EwBwA8l6.............$","expiry":"2019-11-07T22:30:23.7582+08:00"}
rclone config

挂载

rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-non-empty --allow-other --umask=000"

# 若需要指定用户,例如 "www",在 "/etc/passwd/" 中找到用户GID和UID,使用命令
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-non-empty --allow-other --umask=000 --uid=UID --gid=GID"

# 若要挂载供多媒体应用使用,以下为优化
rclone mount DriveName:Folder LocalFolder \
 --umask 000 \
 --default-permissions \
 --allow-non-empty \
 --allow-other \
 --buffer-size 32M \
 --dir-cache-time 12h \
 --vfs-read-chunk-size 64M \
 --vfs-read-chunk-size-limit 1G \
 --uid=UID \
 --gid=GID

开机自启

cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-non-empty --allow-other --umask=000"
Restart=on-abort
User=root

[Install]
WantedBy=default.target
EOF

systemctl start rclone
systemctl enable rclone

卸载

fusermount -u /path/
评论