2024-04-16 09:09:44 +00:00
|
|
|
|
---
|
|
|
|
|
title: rclone-failed-to-get-token
|
|
|
|
|
created: 2024-04-16
|
|
|
|
|
tags:
|
|
|
|
|
- "#rclone"
|
|
|
|
|
- "#mount"
|
2024-06-07 08:11:09 +00:00
|
|
|
|
- onedrive
|
|
|
|
|
- webdav
|
2024-04-16 09:09:44 +00:00
|
|
|
|
---
|
|
|
|
|
## 获取token超时
|
|
|
|
|
### 原因
|
|
|
|
|
添加远程的最后,浏览器显示成功,但命令窗口无法等到token,原因是`命令窗口未使用代理`。[参考连接](https://makifx.com/197.html)
|
|
|
|
|
### 解决方案
|
|
|
|
|
将命令窗口使用代理,具体端口查看代理软件
|
|
|
|
|
```bash
|
|
|
|
|
# 使用sock5代理
|
|
|
|
|
set http_proxy=socks5://127.0.0.1:10808
|
|
|
|
|
set https_proxy=socks5://127.0.0.1:10808
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 无效API/接口
|
2024-04-16 09:17:20 +00:00
|
|
|
|
大概率是未使用最新版本的Rclone,使用`rclone selfupdate`进行升级。
|
|
|
|
|
|
|
|
|
|
## VPS无法使用浏览器添加
|
2024-04-22 08:23:37 +00:00
|
|
|
|
添加过程中注意参数配置,当出现选择时先N,根据提示在本地获取token
|
|
|
|
|
|
|
|
|
|
## 开机启动
|
|
|
|
|
1. **创建 systemd 服务文件**:在 `/etc/systemd/system/` 目录下创建一个新的服务文件。例如:
|
|
|
|
|
`sudo nano /etc/systemd/system/rclone-mount.service`
|
|
|
|
|
在服务文件中添加以下内容:
|
|
|
|
|
```ini
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Rclone Mount Service
|
|
|
|
|
After=network-online.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=simple
|
|
|
|
|
User=your_username
|
|
|
|
|
ExecStart=/usr/bin/rclone mount remote: /mnt/remote \
|
|
|
|
|
--allow-other \
|
|
|
|
|
--daemon \
|
|
|
|
|
--config /home/your_username/.config/rclone/rclone.conf
|
|
|
|
|
|
|
|
|
|
ExecStop=/bin/fusermount -u /mnt/remote
|
|
|
|
|
Restart=always
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
替换 `your_username` 为你的用户名,`remote:` 为你的 rclone 远程存储服务的配置名称,`/mnt/remote` 为你的挂载点。
|
|
|
|
|
|
|
|
|
|
2. **启动并启用服务**:使用以下命令启动服务并将其设置为在系统启动时自动运行:
|
|
|
|
|
```bash
|
|
|
|
|
sudo systemctl enable rclone-mount.service
|
|
|
|
|
sudo systemctl start rclone-mount.service
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. **验证服务是否运行**:你可以使用以下命令检查服务的状态:
|
2024-06-07 08:38:04 +00:00
|
|
|
|
```bash
|
|
|
|
|
sudo systemctl status rclone-mount.service
|
|
|
|
|
```
|
|
|
|
|
|
2024-06-07 08:11:09 +00:00
|
|
|
|
如果服务正常运行,你就成功地在 CentOS 中自动挂载了 rclone 远程存储服务。
|
|
|
|
|
# onedrive
|
2024-06-07 08:38:04 +00:00
|
|
|
|
## 配置
|
2024-06-07 08:11:09 +00:00
|
|
|
|
采用webdav方式挂载,可解决诸多问题。
|
|
|
|
|
```ini
|
|
|
|
|
[odrive]
|
|
|
|
|
type = webdav
|
|
|
|
|
url = https://stduestceducn-my.sharepoint.com/personal/onlyistranger_std_uestc_edu_cn/Documents
|
|
|
|
|
vendor = sharepoint
|
|
|
|
|
user = onlyistranger@std.uestc.edu.cn
|
|
|
|
|
pass = uoiOt3qxdp05UC3QhWQ-AIq1ybhYfnAOEXl-D3BeTcZmIQ
|
2024-06-07 08:38:04 +00:00
|
|
|
|
```
|
|
|
|
|
## 挂载
|
|
|
|
|
使用以下命令
|
|
|
|
|
```bash
|
|
|
|
|
sudo rclone mount odrive:/Pictures/'Camera Roll' photos/ --copy-links \
|
|
|
|
|
--no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty \
|
|
|
|
|
--umask 000 --use-mmap --daemon
|
|
|
|
|
```
|