admin avatar

freebsd系统下配置rclone挂载OneDrive的折腾记录

🕘 by admin

freebsd系统下配置rclone挂载OneDrive的折腾记录

花了几个小时才搞定,写下来给新手小白免得跟我一样花那么多时间

安装rclone即可,命令如下

pkg install rclone

然后就是配置rclone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
rclone config
n/s/q> n
name> onedrive -> 名字,后面使用rclone记得使用的是这个自定义的名字
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 / Alias for a existing remote
   \ "alias"
 2 / Amazon Drive
   \ "amazon cloud drive"
 3 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
   \ "s3"
 4 / Backblaze B2
   \ "b2"
 5 / Box
   \ "box"
 6 / Cache a remote
   \ "cache"
 7 / Dropbox
   \ "dropbox"
 8 / Encrypt/Decrypt a remote
   \ "crypt"
 9 / FTP Connection
   \ "ftp"
10 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
11 / Google Drive
   \ "drive"
12 / Hubic
   \ "hubic"
13 / JottaCloud
   \ "jottacloud"
14 / Local Disk
   \ "local"
15 / Mega
   \ "mega"
16 / Microsoft Azure Blob Storage
   \ "azureblob"
17 / Microsoft OneDrive
   \ "onedrive"
18 / OpenDrive
   \ "opendrive"
19 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
20 / Pcloud
   \ "pcloud"
21 / QingCloud Object Storage
   \ "qingstor"
22 / SSH/SFTP Connection
   \ "sftp"
23 / Webdav
   \ "webdav"
24 / Yandex Disk
   \ "yandex"
25 / http Connection
   \ "http"
Storage> 19  选19为OneDrive

Google Application Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> 留空,按回车下一步就好

Google Application Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> 留空,按回车下一步就好

Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
 2 / Read-only access to file metadata and file contents.
   \ "drive.readonly"
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ "drive.file"
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ "drive.appfolder"
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ "drive.metadata.readonly"
scope> 2  注意 1 是拥有所有权限,包括删除;2 是只能访问所有文件,不能删除,按需要选择吧

ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders. (see docs).
Enter a string value. Press Enter for the default ("").
root_folder_id> -> 留空,按回车下一步就好

Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file> -> 留空,按回车下一步就好

Edit advanced config? (y/n)
y) Yes
n) No
y/n> n -> 一般不需要高级设置,选择 n 就好

Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n> n -> 如果是在 VPS 上连接,选 n 吧




####这里重点介绍一下,在vps或服务器上面是没有安装浏览器的,所以记得选N

解决方法只能先下载rclone到本地windows,然后记住token授权,授权内容如下
token授权只会显示一次,所以记得复制,,,

{"access_token":"EwB4A8******","expiry":"2020-01-01T02:46:34.3979912+08:00"}

记住{也要复制。。。。


If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=**************************************
Log in and authorize rclone for access
#这里需要访问提示的URL然后登陆账号获取授权的Code码,然后复制过来

Enter verification code> **************zN5****vd5*******************bwZethESs 

Configure this as a team drive?
y) Yes
n) No
y/n> n

--------------------
[remote]
client_id = 
client_secret = 
scope = drive
root_folder_id = 
service_account_file =
token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2018-09-16T13:57:58.955387075Z"}
--------------------
###这里填写你在本地windows的授权token。。。

y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y

基本上就完成了。。下面是rclone的常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
rclone lsd onedrive:
//列出远程的文件
rclone ls onedrive:
rclone sync /usr/local/etc/ onedrive:/file/conf
//同步本地文件到远程的onedrive,类似于增量备份。。。
rclone copy /home/testuser ondrive:test #复制本地/home/testuser到配置名为ondrive的网盘的test目录,替换路径则为拉取远程文件数据
rclone move /home/testuser ondrive:test #剪切操作
rclone delete ondrive:test #删除
rclone mkdir ondrive:test #创建
rclone sync ondrive:test ondrive:test#同步本地/home/testuser到ondrive目录


rclone config – 以控制会话的形式添加rclone的配置,配置保存在.rclone.conf文件中。 
rclone copy – 将文件从源复制到目的地址,跳过已复制完成的。 
rclone mount-挂载
rclone sync – 将源数据同步到目的地址,只更新目的地址的数据。 
rclone move – 将源数据移动到目的地址。
rclone delete – 删除指定路径下的文件内容。 
rclone purge – 清空指定路径下所有文件数据。 
rclone mkdir – 创建一个新目录。 
rclone rmdir – 删除空目录。 
rclone check – 检查源和目的地址数据是否匹配。
rclone ls – 列出指定路径下所有的文件以及文件大小和路径。
rclone lsd – 列出指定路径下所有的目录/容器/桶。
rclone lsl – 列出指定路径下所有文件以及修改时间、文件大小和路径。
rclone md5sum – 为指定路径下的所有文件产生一个md5sum文件。 
rclone sha1sum – 为指定路径下的所有文件产生一个sha1sum文件。 
rclone size – 获取指定路径下,文件内容的总大小。
rclone version – 查看当前版本。 
rclone cleanup – 清空remote。 
rclone dedupe – 交互式查找重复文件,进行删除/重命名操作。

记住onedrive的名称就是你刚才创建rclone配置文件时的名字。。。别搞错了,,,

💘 相关文章

写一条评论