Script 12 · Remote Storage
12. rclone GDrive Ubuntu
Installs rclone and writes a Google Drive remote configuration for backup storage.
Category: Remote Storage
Risk: High
Lines: calculating
Language: Bash / Linux
What this script does
- Connect the VPS to Google Drive.
- Provide a destination for database backups.
- Validate the remote with rclone lsd.
Prerequisites
- Root or sudo access
- Internet access
- Valid rclone OAuth token
- Google Drive account access
Execution flow
- Runs rclone installer
- Writes ~/.config/rclone/rclone.conf
- Locks config permissions
- Tests gdrive remote
Validation checklist
- rclone listremotes
- rclone lsd gdrive:
- ls -l ~/.config/rclone/rclone.conf
Operational cautions
- OAuth tokens and client secrets are sensitive.
- Rotate credentials if this file was shared.
- Prefer interactive rclone config for production.
Original script notes
ℹ️ Script Info: Installs rclone and automatically injects an OAuth token configuration to connect your server directly to a designated Google Drive for remote storage and backups.
sudo -v ; curl https://rclone.org/install.sh | sudo bash && \
mkdir -p ~/.config/rclone && \
cat << 'EOF' > ~/.config/rclone/rclone.conf
[gdrive]
type = drive
client_id = 1083603479425-7356k1m1uqeqt438iaccm2ndmjj5skc3.apps.googleusercontent.com
client_secret = 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
scope = drive
token = {"access_token":"ya29.a0AUMWg_JE_urvB_kGZRPsP_OQt2jGqQiAOyva0fqs9EskOCd_-NcFVKlVSXB5TU99R20NTCWv32xMU-dv1Ub4IlPMJXfsioBgP08MZjFEC1D97sIKnFHmA9uBiTKn_fQV0qzR9jhaNTadtkidXbLMvqfyrnPDom27NJmofHTV7QYV1uLnPjxcxXJilNAhxaWw6Q02FyQaCgYKAfsSARESFQHGX2MiamWKyytZmndB9HMSUkcORA0206","token_type":"Bearer","refresh_token":"1//0gSYUCYcsmwsNCgYIARAAGBASNwF-L9IrfHrjy3jnm5vwXskh6YvfMSMDP8dgQzfkB5jw2IuSDuVVWxvO0ZWV6SU6vfLF3BBvk_0","expiry":"2026-02-04T23:22:04.958324+07:00","expires_in":3599}
team_drive =
EOF
chmod 600 ~/.config/rclone/rclone.conf && \
echo -e "\n\033[1;33m=== TESTING CONNECTION ===\033[0m" && \
rclone lsd gdrive: && \
echo -e "\n\033[1;32m[DONE] Setup Successful and Connected.\033[0m"