1. Home
  2. Docs
  3. Admin Guide
  4. Backup and Restore
  5. Integration with Google Drive

Integration with Google Drive

Download GDrive binary

# For x64

wget -O gdrive https://drive.google.com/uc?id=1Ej8VgsW5RgK66Btb9p74tSdHMH3p4UNb&export=download

# More versions:

Move and Permissions

mv gdrive /usr/sbin/gdrive
chmod 755 /usr/sbin/gdrive

Authentication process

To generate the authentication URL just run:


# You must paste the link in your desktop browser. Accept the permission and you will get a verification code. You must copy the verification code and paste it into the shell “Enter verification code
# You have installed GDrive in CWP and connected to your Google Drive account.

Make a remote parent folder

# Alternative One
You must go to his Google Drive and create a folder. Then, go to the folder. Now, look at the URL. At the end of the URL, you can see the folder’s path. Look at the screenshot to be clear:

So, 1Qaz_xExWqnZV0kIlhV335crKGUMh3wnI is the token folder. This token will be used later.

# Alternative Two
Simply run:

gdrive mkdir <folder name>

This will return the token

Directory 1Qaz_xExWqnZV0kIlhV335crKGUMh3wnI created

Upload a single file **RECOMMENDED**


tar -czf "/tmp/test-backup-$(date '+%d-%m-%Y').tar.gz" /backup/daily/<user>
gdrive upload --parent 1Qaz_xExWqnZV0kIlhV335crKGUMh3wnI /tmp/test-backup-99-99-9999.tar.gz --delete

Upload multi files and subfolders **NO RECOMMENDED – TOO SLOW**

gdrive upload --parent --recursive 1Qaz_xExWqnZV0kIlhV335crKGUMh3wnI /backup/daily/<user>


gdrive sync upload /backup/daily/<user> 1Qaz_xExWqnZV0kIlhV335crKGUMh3wnI


  • With the above commands you can create a custom cronjob that executes backups unattended.
  • If a file that already exists in the Google Drive folder is uploaded (doesn’t apply to the sync command), it isn’t overwritten, it creates an exact copy.
  • If a syncronize folder (sync command) is used at least once, it can no longer be used with the upload command.

More info:

Was this article helpful to you? Yes 2 No 9