Clone Files to Cloud Storage
From WickyWiki
Links
- http://wiki.linuxquestions.org/wiki/Rsync_with_Google_Drive
- https://rclone.org/drive/
- https://developers.google.com/identity/protocols/OAuth2ServiceAccount
Install
wget https://rclone.org/install.sh sudo ./install.sh
Configure
Google Drive Client Access
This will grant access for a couple of hours.
rclone config n/s/q> n # New name> remote # remote is an example name Storage> drive # Google Drive client_id> client_secret> scope> 1 # Select your scope, 1 = full root_folder_id> svc acc file> Auto config> y #login with your gmail account and allow access Team drives> n
From local to Google Drive, name 'remote', folder 'rclone'
rclone sync -v ~/test4.txt "[remote]:/rclone/"
From Google Drive to local
rclone sync -v "remote:/rclone/test4.txt" ~/rclone/
Google Drive Service Account
We will need a json file
TODO Accesibility of files - can't see the files of the other account in Google Drive
Create a service account :
- To create a service account and obtain its credentials, go to the Google Developer Console. [https://console.developers.google.com/apis/dashboard
- You must have a project - create one if you don’t.
- Use the “Create Credentials” button. Fill in “Service account name” with something that identifies your client. “Role” can be empty.
- select “Key type JSON”.
- If you ever need to remove access, press the “Delete service account key” button.
- save the json file for use with rclone config
rclone config
... service_account_file> ~/Uploader-75551fa3f8b6.json ...
Encrypted
Define an encrypted target, the configured remote in the previous paragraph will be used as storage.
rclone config Current remotes: Name Type ==== ==== remote drive e/n/d/r/c/s/q> n name> cryptremote Storage> crypt remote> remote:/rclone/encrypted filename_encryption> 2 directory_name_encryption> 1 type password y/g/n> y seed y/g/n> n advanced config y/n> n
From local to Google Drive, name 'cryptremote'
rclone sync -v ~/test4.txt "cryptremote:/"