How to Give OpenClaw Local Google Drive Access with rclone
A reusable guide for mounting Google Drive inside an OpenClaw Linux environment with rclone.
Make Google Drive show up as a normal folder on your OpenClaw computer, so your agent can read, write, copy, move, search, and organize files like any other folder.
Why do this?
OpenClaw can already access Google Drive via the built-in connector, but it's limited. It works with Google Sheets and Docs, but it can't copy or move ordinary files to or from Drive.
The fix is to mount your Drive as a local folder using rclone. Once mounted, Drive behaves like any directory on the machine:
- Read and write Markdown, PDFs, images, and any other file type
- Copy, move, rename, and delete files
- Search across folders and organize directory trees
rclone connects to Drive over Google's secure OAuth login and can mount either your personal Google Drive or a shared drive.
The fastest way: let OpenClaw set it up
You don't have to run any of this yourself. Paste the prompt below into your OpenClaw chat, and your agent will handle the entire setup, pausing only when it needs you to log in to Google or save a secret.
What you are building
By the end, you will have:
- rclone installed on the OpenClaw computer
- a Google Drive remote configured in rclone
- the Google OAuth credential stored as a runtime secret, not pasted in chat
- a local mount path such as
/var/lib/tinyhat-openclaw/drive/google-drive - a helper script the agent can run when the mount needs to be refreshed
Before you start
You need:
- access to the OpenClaw computer
- a Google account with access to the Drive or shared drive you want mounted
- a computer with a browser where you can complete Google's OAuth login
- a secure way to add runtime secrets to OpenClaw
Important: this is not a simple Google API key setup. rclone uses a Google OAuth authorization token. Treat that token like a secret.
The prompt to give OpenClaw
Copy this prompt into your OpenClaw chat:
I want you to set up local Google Drive access for this OpenClaw using rclone.
Goal:
- Install official rclone on this Linux machine.
- Configure a Google Drive remote.
- Mount it as a local filesystem path so you can use normal file operations instead of Google Drive APIs.
- Store credentials only through the runtime secret mechanism, not in chat.
Use these defaults unless there is a reason to change them:
- Remote name: gdrive
- Mount path: /var/lib/tinyhat-openclaw/drive/google-drive
- Config path: /var/lib/tinyhat-openclaw/.config/rclone/rclone.conf
- Helper script: /var/lib/tinyhat-openclaw/workspace/scripts/mount-google-drive-rclone.sh
Ask me whether I want to mount:
1. my personal Google Drive, or
2. a Google shared drive.
If I choose a shared drive, ask me for the shared drive ID or help me find it. If I choose personal Drive, configure it without a team_drive value.
Authentication:
- Install rclone first.
- Ask me to run rclone authorize on a computer where I can open a browser.
- Have me save the resulting OAuth JSON as runtime secret RCLONE_GOOGLE_AUTH_JSON.
- Do not ask me to paste the OAuth JSON directly in chat.
After the secret is saved:
- Load RCLONE_GOOGLE_AUTH_JSON into the rclone config token field.
- Verify with: rclone lsd gdrive:
- Mount it at the local path.
- Verify by listing the mount path and, if safe, creating and deleting a small test file.
Please do the setup end-to-end and tell me exactly what succeeded or what needs my action.Reference: the manual steps
You only need this section if you're doing the setup yourself or want to verify whatyour agent did.
Step 1: Install rclone
On many Debian/Ubuntu-style Linux machines, the official installer works:
curl https://rclone.org/install.sh | sudo bash
rclone versionIf sudo is not available, install rclone using the platform package manager or place the rclone binary in a user-writable tools directory.
Step 2: Create the rclone remote
For personal Google Drive:
mkdir -p /var/lib/tinyhat-openclaw/.config/rclone
rclone config create gdrive drive scope drive --config /var/lib/tinyhat-openclaw/.config/rclone/rclone.confFor a Google shared drive, include the shared drive ID:
mkdir -p /var/lib/tinyhat-openclaw/.config/rclone
rclone config create gdrive drive scope drive team_drive YOUR_SHARED_DRIVE_ID --config /var/lib/tinyhat-openclaw/.config/rclone/rclone.confReplace YOUR_SHARED_DRIVE_ID with the ID for your shared drive.
Step 3: Authorize Google Drive
On a computer where you can open a browser, run:
rclone authorize "drive" '{"scope":"drive"}'rclone will open a Google authorization flow. When it finishes, it will print a JSON authorization result.
Save that JSON into an OpenClaw runtime secret named:
RCLONE_GOOGLE_AUTH_JSONStep 4: Load the secret into rclone
Once RCLONE_GOOGLE_AUTH_JSON is available in the OpenClaw runtime environment, the agent should write the OAuth token into the appropriate remote section of rclone.conf. The final remote should include a token = ... entry.
Then verify the remote:
RCLONE_CONFIG=/var/lib/tinyhat-openclaw/.config/rclone/rclone.conf rclone lsd gdrive:If this lists folders from Google Drive, the remote is working.
Step 5: Mount Drive as a local folder
Create the mount path:
mkdir -p /var/lib/tinyhat-openclaw/drive/google-driveSave this helper script to/var/lib/tinyhat-openclaw/workspace/scripts/mount-google-drive-rclone.sh:
#!/usr/bin/env bash
set -euo pipefail
remote="gdrive:"
mount_dir="/var/lib/tinyhat-openclaw/drive/google-drive"
config="/var/lib/tinyhat-openclaw/.config/rclone/rclone.conf"
log_file="/var/lib/tinyhat-openclaw/workspace/rclone-google-drive.log"
mkdir -p "$mount_dir"
if mountpoint -q "$mount_dir"; then
echo "Google Drive is already mounted at $mount_dir"
exit 0
fi
RCLONE_CONFIG="$config" rclone mount "$remote" "$mount_dir" --daemon --vfs-cache-mode writes --log-file "$log_file" --log-level INFO
echo "Mounted Google Drive at $mount_dir"Make it executable and run it:
chmod +x /var/lib/tinyhat-openclaw/workspace/scripts/mount-google-drive-rclone.sh
/var/lib/tinyhat-openclaw/workspace/scripts/mount-google-drive-rclone.shStep 6: Verify the mount
mount | grep rclone
ls /var/lib/tinyhat-openclaw/drive/google-driveIf it is safe to write a temporary file, test write access:
echo "rclone mount test $(date -Is)" > /var/lib/tinyhat-openclaw/drive/google-drive/rclone-sync-test.md
ls /var/lib/tinyhat-openclaw/drive/google-drive/rclone-sync-test.md
rm /var/lib/tinyhat-openclaw/drive/google-drive/rclone-sync-test.mdYou now have Google Drive as a local folder. π
Troubleshooting
If the mount becomes stale, you may see errors such as Transport endpoint is not connected. Remount it:
mountpoint -q /var/lib/tinyhat-openclaw/drive/google-drive && echo mounted || echo not-mounted
fusermount3 -uz /var/lib/tinyhat-openclaw/drive/google-drive || umount -l /var/lib/tinyhat-openclaw/drive/google-drive
/var/lib/tinyhat-openclaw/workspace/scripts/mount-google-drive-rclone.shYou can also bypass the FUSE mount and use rclone directly:
RCLONE_CONFIG=/var/lib/tinyhat-openclaw/.config/rclone/rclone.conf rclone lsd gdrive:Security checklist
- π Never paste the OAuth token JSON into chat
- π Never commit
rclone.confif it contains a token - π Never print secret values into logs
- π Use the narrowest Google account and Drive access your workflow needs
- π If the token is ever exposed, revoke it in your Google account and rotate the
RCLONE_GOOGLE_AUTH_JSONsecret
When to use this, and when not to
| Use a local mount for⦠| Use Drive APIs / native Docs for⦠|
|---|---|
| Markdown, project docs, reports, research notes | Google Docs comments and suggestions |
| Any file-based workflow | Structured Docs/Sheets formatting |
| Copying, moving, organizing files | Google-native document features |
The mount shines when OpenClaw benefits from seeing a normal directory tree. Reach for the native Google tooling when you specifically need Google document features.
Comments ()