Rclone挂载Webdav作为本地磁盘
本文最后由豫见长安更新于2024 年 11 月 4 日,已超过68天没有更新。如果文章内容或图片资源失效,请留言反馈,将会及时处理,谢谢!
1.Rclone 在这里下载 https://rclone.org/downloads/
2.WinFsp 在这里下载 http://www.secfs.net/winfsp/rel/
NOTE:下面步骤很关键,最好用8倍镜查看
1.将Rclone添加到系统环境变量中
1.右键 计算机-选择 属性-选择 高级系统配置-点击 高级 这个界面在下方就有一个【环境变量】,点击进入接下面步骤
2.在 系统变量 里 找到变量名为 Path 双击或者点击编辑,添加Rclone解压后的路径,比如我(C:\rclone)
到此完成基本设定!
可以使用 powershell 或者cmd 执行配置挂载
开始执行命令
#输入命令 rclone config
using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q>n //n是创建一个挂载
name> Txcos //自己命名标识等下要用到
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / 1Fichier
\ "fichier"
........
Storage> 4 //这里是挂载阿里云OSS或者腾讯云COS 都是输入4
Choose your S3 provider.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Amazon Web Services (AWS) S3
\ "AWS"
........
provider> 11 //挂载腾讯云COS输入11 挂载阿里云OSS输入2
Get AWS credentials from runtime (environment variables or EC2/ECS meta data if
no env vars).
Only applies if access_key_id and secret_access_key is blank.
Enter a boolean value (true or false). Press Enter for the default ("false").
Choose a number from below, or type in your own value
1 / Enter AWS credentials in the next step
\ "false"
2 / Get AWS credentials from the environment (env vars or IAM)
\ "true"
env_auth> 1 //输入1
AWS Access Key ID.
Leave blank for anonymous access or runtime credentials.
Enter a string value. Press Enter for the default ("").
access_key_id> ****** //输入腾讯云或者阿里云的access_key_id,自己控制面板获取
AWS Secret Access Key (password)
Leave blank for anonymous access or runtime credentials.
Enter a string value. Press Enter for the default ("").
secret_access_key> ****** //输入腾讯云或者阿里云的secret_access_key,自己控制面板获取
Endpoint for Tencent COS API.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Beijing Region.
\ "cos.ap-beijing.myqcloud.com"
........
endpoint> 4 //选择你的存储节点,如果 北京 广州...等等看拼音或者对链接选择对应数字
........
Note that this ACL is applied when server-side copying objects as S3
doesn't copy the ACL from the source but rather writes a fresh one.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Owner gets Full_CONTROL. No one else has access rights (default).
\ "default"
........
acl> 2 //选择存储桶的全新, 1是私有读写 2是私写公读 3是全开放
The storage class to use when storing new objects in Tencent COS.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Default
\ ""
2 / Standard storage class
\ "STANDARD"
3 / Archive storage mode.
\ "ARCHIVE"
4 / Infrequent access storage mode.
\ "STANDARD_IA"
storage_class>
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n //输入n
Remote config
--------------------
[Txcos]
type = s3
provider = TencentCOS
env_auth = false
access_key_id = 我是马赛克
secret_access_key = 我是马赛克
endpoint = cos.ap-guangzhou.myqcloud.com
acl = public-read
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y //输入y
Current remotes:
Name Type
==== ====
Txcos s3
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q //输入q退出
OK到这里就结束了挂载第一步,总结下输入命令哪些
1.启用工具 rclone config
2.创建挂载 n
3.输入标识盘符 (第二步要用到)
4.选择挂载类型 4
5.选择挂载产品 挂载腾讯云COS输入11 挂载阿里云OSS输入2
6.输入 1
7.输入access_key_id
8.输入secret_access_key
9.选择节点
10.选择读写权限
11.输入 1
12.输入 n
13.输入 y
14.输入 1
第二步
开始挂载上存储盘到本地,继续输入
rclone mount Txcos:/ F: --cache-dir D:\boxmoe_Cache --vfs-cache-mode writes
//Txcos 是第一步第三输入rclone标识盘符
//F:是挂载的本地磁盘盘符A-Z自己输个没占用的
//D:\boxmoe_Cache 是缓存的位置
这种是临时挂载,如果把cmd 或者 powershell关了也就消失!如果要长期可用自动挂载则可以用以下操作(来源网络https://blog.rhilip.info/archives/874/)
在你之前解压的rclone目录下新建一个文本文件,填入以下内容,请注意修改倒数第二行的WS.Run中相关命令为你上步成功执行的命令,然后将该文件名改为rclone.vbs (后缀名为.vbs即可)
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 Txcos:/ F: --cache-dir D:\boxmoe_Cache --vfs-cache-mode writes", 0
end if
完成后双击运行,你会看到X盘挂载成功{放到系统启动里,则可以自动启动}
教程2
3 Rclone导入服务器
在rclone.exe应用程序所在文件夹右键,选择在终端中打开
输入
.\rclone.exe config
进入服务器的设置界面
Current remotes:
Name Type
==== ====
webdav webdav
e) Edit existing remote #修改服务器设置
n) New remote #新设置
d) Delete remote #删除设置
r) Rename remote #重命名设置
c) Copy remote #复制设置
s) Set configuration password #设置配置设置密码
q) Quit config #退出设置
e/n/d/r/c/s/q>
全部设置参考
Current remotes:
Name Type
==== ====
webdav webdav
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
# 输入n 选择新创建设置
Enter name for new remote.
name> webdav
# 输入新设置的名称
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, DigitalOcean, Dreamhost, GCS, HuaweiOBS, IBMCOS, IDrive, IONOS, LyveCloud, Leviia, Liara, Linode, Magalu, Minio, Netease, Petabox, RackCorp, Rclone, Scaleway, SeaweedFS, StackPath, Storj, Synology, TencentCOS, Wasabi, Qiniu and others
\ (s3)
5 / Backblaze B2
\ (b2)
6 / Better checksums for other remotes
\ (hasher)
7 / Box
\ (box)
8 / Cache a remote
\ (cache)
9 / Citrix Sharefile
\ (sharefile)
10 / Combine several remotes into one
\ (combine)
11 / Compress a remote
\ (compress)
12 / Dropbox
\ (dropbox)
13 / Encrypt/Decrypt a remote
\ (crypt)
14 / Enterprise File Fabric
\ (filefabric)
15 / FTP
\ (ftp)
16 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
17 / Google Drive
\ (drive)
18 / Google Photos
\ (google photos)
19 / HTTP
\ (http)
20 / Hadoop distributed file system
\ (hdfs)
21 / HiDrive
\ (hidrive)
22 / ImageKit.io
\ (imagekit)
23 / In memory object storage system.
\ (memory)
24 / Internet Archive
\ (internetarchive)
25 / Jottacloud
\ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
27 / Linkbox
\ (linkbox)
28 / Local Disk
\ (local)
29 / Mail.ru Cloud
\ (mailru)
30 / Mega
\ (mega)
31 / Microsoft Azure Blob Storage
\ (azureblob)
32 / Microsoft Azure Files
\ (azurefiles)
33 / Microsoft OneDrive
\ (onedrive)
34 / OpenDrive
\ (opendrive)
35 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)
\ (swift)
36 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
37 / Pcloud
\ (pcloud)
38 / PikPak
\ (pikpak)
39 / Proton Drive
\ (protondrive)
40 / Put.io
\ (putio)
41 / QingCloud Object Storage
\ (qingstor)
42 / Quatrix by Maytech
\ (quatrix)
43 / SMB / CIFS
\ (smb)
44 / SSH/SFTP
\ (sftp)
45 / Sia Decentralized Cloud
\ (sia)
46 / Storj Decentralized Cloud Storage
\ (storj)
47 / Sugarsync
\ (sugarsync)
48 / Transparently chunk/split large files
\ (chunker)
49 / Uloz.to
\ (ulozto)
50 / Union merges the contents of several upstream fs
\ (union)
51 / Uptobox
\ (uptobox)
52 / WebDAV
\ (webdav)
53 / Yandex Disk
\ (yandex)
54 / Zoho
\ (zoho)
55 / premiumize.me
\ (premiumizeme)
56 / seafile
\ (seafile)
Storage> 52
# 选择webdav对应的编号 我这边为52 需要根据你实际编号选择
Option url.
URL of http host to connect to.
E.g. https://example.com.
Enter a value.
url> http://192.168.1.1:8800
# 输入你Webdav服务器对应的链接与端口
Option vendor.
Name of the WebDAV site/service/software you are using.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Fastmail Files
\ (fastmail)
2 / Nextcloud
\ (nextcloud)
3 / Owncloud
\ (owncloud)
4 / Sharepoint Online, authenticated by Microsoft account
\ (sharepoint)
5 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
\ (sharepoint-ntlm)
6 / rclone WebDAV server to serve a remote over HTTP via the WebDAV protocol
\ (rclone)
7 / Other site/service or software
\ (other)
vendor> 7
# Rclone提供了几种常用的Webdav设置 我为自己搭建 选择7(other)
Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a value. Press Enter to leave empty.
user> DAV_user
# 输入Webdav用户名
Option pass.
Password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
# 需要密码 选择y
Enter the password:
password:
Confirm the password:
password:
# 输入密码时不会显示密码
Option bearer_token.
Bearer token instead of user/pass (e.g. a Macaroon).
Enter a value. Press Enter to leave empty.
bearer_token>
# 没有设置令牌按回车留空
Edit advanced config?
y) Yes
n) No (default)
y/n> n
# 开启高级设置 这边并不需要 选择n
#确认你的设置是否有错误
Configuration complete.
Options:
- type: webdav
- url: http://192.168.1.30:8800
- vendor: other
- user: DAV_user
- pass: *** ENCRYPTED ***
Keep this "webdav" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
# 确认无误
Current remotes:
Name Type
==== ====
webdav webdav
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>q
# 可以看到自己的设置了 退出
4 Rclone挂载
设置完服务器后,便可以使用Rclone进行挂载了
在Rclone所在文件夹打开命令行,输入
.\rclone.exe mount webdav:/ W: --vfs-cache-mode writes --cache-dir ./cache --log-level INFO --progress --file-perms 0777
下面分开解释命令意义
.\rclone.exe
指代当前文件夹下的rclone.exe文件
mount
挂载命令
webdav:/ W:
webdav指的是你设置的名称 :/表示挂载的远程文件夹 W:指挂载在电脑上的盘符
--vfs-cache-mode writes
vfs虚拟文件系统 缓存模式 写入
Rclone存在4种缓存模式:off|minimal|writes|full
缓存模式越高,rclone 的兼容性就越好,但会占用更多的磁盘空间
如果你的网速够快可以考虑选择off 关闭缓存
--cache-dir ./cache
缓存目录 这里./cache指 在本文件夹下的cache文件夹中
--log-level INFO --progress
让命令行输入INFO类型的日志 同时显示上传或下载的进度条
--file-perms 0777
更改文件权限 设置为全部权限(UNIX格式)
默认的权限为0666,即不包含运行权限
如果你不需要在挂载中运行exe程序可以忽略该行
5 设置Rclone开机启动
注意修改下文中所有命令的对应名称,并确认你是否需要以下功能
D:\Rclone\rclone.exe
rclone.exe文件所在的文件路径
webdav:/ W:
webdav:设置的名称 W:挂载的本地位置
–file-perms 0777
文件权限设置 不需要运行exe文件可以忽略
5.1 有命令行窗口实现方法
但由于此方式仍有命令行常驻桌面,5.2有用vbs来实现隐藏命令行的效果
此设置开机启动方式为设置bat文件
新建txt文本,放入以下内容
D:\Rclone\rclone.exe mount webdav:/ W: --vfs-cache-mode off --file-perms 0777
将txt文本后缀改为bat
将bat文件放入Windows的启动目录中C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
5.2 隐藏命令行窗口实现方法
此设置开机启动方式为设置bat文件,用vbs文件打开bat文件隐藏命令行窗口
新建txt文本,放入以下内容
D:\Rclone\rclone.exe mount webdav:/ W: --vfs-cache-mode off --file-perms 0777
将txt文本后缀改为bat
新建txt文本,放入以下内容
CreateObject("WScript.Shell").Run "cmd /c D:\Rclone/rclone.bat",0
将txt文本后缀改为vbs
将vbs文件放入Windows的启动目录中C:\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
文章标题:Rclone挂载Webdav作为本地磁盘
文章链接:https://zhaojx.fun/archives/633/
最后编辑:2024 年 11 月 4 日 23:49 By 豫见长安
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)