1. Installation#

sudo apt update && sudo apt install rclone -y

—s

2. Configuration#

Run the configuration wizard and follow these specific prompts to link your account.

rclone config

Prompts:

  • Name: MarcGoogleDocs
  • Type: drive (Google Drive)
  • Scope: 1 (Full Access)
  • Use Web Browser (for headless VM): n
  • Note: Run the rclone authorize command on your Mac as prompted, then copy/paste the token back into the server terminal.

3. The “Clean” Sync Command#

This command pulls files, converts Google-specific formats to Office formats (docx, xlsx), and fixes ‘é’ encoding issues.

rclone sync MarcGoogleDocs: /mnt/GoogleDocs \
--local-encoding "None" \
--drive-export-formats docx,xlsx,pptx,svg \
--drive-acknowledge-abuse \
--verbose --progress

4. Permissions#

Ensure the Nextcloud web user can access the synchronized files.

# Hand over ownership to the Nextcloud web user
sudo chown -R www-data:www-data /mnt/GoogleDocs
# Set appropriate read/write permissions
sudo chmod -R 775 /mnt/GoogleDocs

5. Automation (Cron Job)#

To keep your local copies updated automatically every hour.

  1. Open the crontab editor:
crontab -e
  1. Paste the following line at the bottom:
0 * * * * rclone sync MarcGoogleDocs: /mnt/GoogleDocs --local-encoding "None" --drive-export-formats docx,xlsx --quiet