I'm trying to use duplicity to backup my files from my Linux desktop.
I read the answer to this question How do I backup to google drive using duplicity? dating from 2015 but it might be obsolete ?
From the duplicity documentation, https://duplicity.gitlab.io/stable/duplicity.1.html, I understand I have to :
{
"installed":{
"client_id":"XXXXXXXX.apps.googleusercontent.com",
"project_id":"mybackup-12345","auth_uri":"https://accounts.google.com/o/oauth2/auth",
"token_uri":"https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
"client_secret":"XXXXXXX",
"redirect_uris":["http://localhost"]
}
}
export GOOGLE_SERVICE_JSON_FILE=/home/myuser/backups/google_client_secret_json_file.json
export GOOGLE_CREDENTIALS_FILE=/home/myuser/backups/google_credentials_file
(this file does not exist yet, I supposed that duplicity would create it after the first login)export GOOGLE_SERVICE_ACCOUNT_URL="mybackup-12345@mybackup-12345.iam.gserviceaccount.com"
duplicity /home/myuser/Documents gdrive://${GOOGLE_SERVICE_ACCOUNT_URL}/backups/documents?myDriveFolderID=root
I tried other values before, but I guess this should not be far from what I should do. But I get this (python) error now :
google.auth.exceptions.MalformedError: Service account info was not in the expected format, missing fields client_email, token_uri.
Based on your google\_client\_secret\_json\_file.json
file, this doesn't contain the json objects needed and as explained by the error google.auth.exceptions.MalformedError: Service account info was not in the expected format, missing fields client\_email, token\_uri.
You will need to generate a Service Account key instead by following this reference article.
Sample format for Service Account credentials:
{
"type": "service_account",
"project_id": "[PROJECT ID]",
"private_key_id": "[PRIVATE KEY ID]",
"private_key": "-----BEGIN PRIVATE KEY----- [PRIVATE KEY HERE] -----END PRIVATE KEY-----\n",
"client_email": "[SERVICE ACCOUNT EMAIL]",
"client_id": "[CLIENT-ID]",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[EMAIL].iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}