← 返回
未分类 Key 中文

Google Drive Setup

Configure Google Drive mount on Linux via rclone + gog OAuth. Use when user wants to mount Google Drive as local filesystem, set up auto-mount on boot, or co...
在 Linux 上使用 rclone + gog OAuth 配置 Google Drive 挂载。适用于将 Google Drive 挂载为本地文件系统、设置开机自动挂载或进行其他相关配置。
tonglinmu
未分类 clawhub v1.1.0 1 版本 99723.8 Key: 需要
★ 0
Stars
📥 361
下载
💾 0
安装
1
版本
#latest

概述

Google Drive Setup

Mount Google Drive as a local filesystem using rclone, with OAuth via gog CLI.

Prerequisites

  • gog CLI installed and authenticated (see gog skill)
  • rclone installed
  • fuse / fusermount available

Step 1: Get OAuth Credentials from gog

gog already has a valid refresh token. Export it:

export GOG_KEYRING_PASSWORD=<your-password>
gog auth tokens export <email@gmail.com> --out /tmp/gog_token.json --overwrite

Extract the refresh_token, client_id, and client_secret from:

  • /tmp/gog_token.json → refresh_token
  • ~/.config/gogcli/credentials.json → client_id, client_secret

Step 2: Configure rclone

Write ~/.config/rclone/rclone.conf:

[GoogleDrive]
type = drive
client_id = <client_id>
client_secret = <client_secret>
scope = drive
token = {"access_token":"","token_type":"Bearer","refresh_token":"<refresh_token>","expiry":"2026-01-01T00:00:00Z"}
team_drive =

Manually refresh the access token (rclone will auto-refresh thereafter):

curl -s -X POST https://oauth2.googleapis.com/token \
  -d client_id=<client_id> \
  -d client_secret=<client_secret> \
  -d refresh_token=<refresh_token> \
  -d grant_type=refresh_token

Update rclone.conf with the returned access_token and real expiry time.

Verify: rclone lsd GoogleDrive:

Step 3: Mount to Filesystem

mkdir -p /mnt/gdrive
rclone mount GoogleDrive: /mnt/gdrive \
  --daemon \
  --vfs-cache-mode full \
  --vfs-cache-max-size 2G \
  --dir-cache-time 72h \
  --allow-other

Step 4: Auto-mount on Boot (systemd)

Create /etc/systemd/system/rclone-gdrive.service:

[Unit]
Description=rclone mount Google Drive
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/bin/rclone mount GoogleDrive: /mnt/gdrive --vfs-cache-mode full --vfs-cache-max-size 2G --dir-cache-time 72h --allow-other
ExecStop=/bin/fusermount -u /mnt/gdrive
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable:

systemctl daemon-reload
systemctl enable rclone-gdrive
systemctl start rclone-gdrive

Troubleshooting

  • "empty token found": rclone config has no valid token. Re-do Step 2.
  • "token expired and no refresh token": refresh_token missing from rclone.conf.
  • "Object does not exist at path /": gog keyring backend issue. Switch to file: gog auth keyring file and set GOG_KEYRING_PASSWORD.
  • "access_denied" / "developer hasn't given you access": Add user as test user in Google Cloud Console → OAuth consent screen.
  • OAuth app type must be "Desktop app": Web-type credentials redirect_uri won't work for remote servers. Use Desktop type.

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-07 13:06 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,232 📥 268,311
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,086 📥 814,823
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 325,909