labbots / google-drive-upload

Bash scripts to upload files to google drive
https://labbots.github.io/google-drive-upload/
MIT License
698 stars 145 forks source link

[FEATURE] Support for service accounts #122

Open Akianonymus opened 4 years ago

Akianonymus commented 4 years ago

Reference: https://cloud.google.com/iam/docs/service-accounts

To upload more than 750gb per day.

Akianonymus commented 4 years ago

@renatowow14

I have created a pull request for service accounts: https://github.com/labbots/google-drive-upload/pull/123

Install ( reinstall ) test_gupload

curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- --uninstall -c test_gupload
curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- -c test_gupload -B wip -r Akianonymus/google-drive-upload

How to generate service accounts: https://github.com/Akianonymus/google-drive-upload/tree/wip#generating-service-account-credentials

How to use it: https://github.com/Akianonymus/google-drive-upload/tree/wip#for-service-accounts

Test and report.

renatowow14 commented 4 years ago

@ renatowow14

Eu criei uma solicitação pull para contas de serviço: # 123

Instalar (reinstalar) test_gupload

curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- --uninstall -c test_gupload
curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- -c test_gupload -B wip -r Akianonymus/google-drive-upload

Como gerar contas de serviço: https://github.com/Akianonymus/google-drive-upload/tree/wip#generating-service-account-credentials

Como usar: https://github.com/Akianonymus/google-drive-upload/tree/wip#for-service-accounts

Teste e relatório.

Okay, I'll try and bring the results.

renatowow14 commented 3 years ago

@renatowow14

I have created a pull request for service accounts: #123

Install ( reinstall ) test_gupload

curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- --uninstall -c test_gupload
curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- -c test_gupload -B wip -r Akianonymus/google-drive-upload

How to generate service accounts: https://github.com/Akianonymus/google-drive-upload/tree/wip#generating-service-account-credentials

How to use it: https://github.com/Akianonymus/google-drive-upload/tree/wip#for-service-accounts

Test and report.

I set up the service account and generated the key and downloaded the .json file. I am informed of it with the syntax -sa it is correct, right?

-> test_gupload -sa /root/backup_lapig_gdrive_chave_de_acesso.json folder_name

I'm sending the data, but it doesn't appear in my google drive account, I tried to browse the drive but I couldn't find it, when trying to access the link that generates access after going up, he asks to request access to the owner, I'm confused

renatowow14 commented 3 years ago

@ renatowow14 Eu criei uma solicitação pull para contas de serviço: # 123 Instalar (reinstalar) test_gupload

curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- --uninstall -c test_gupload
curl --compressed -Ls https://github.com/Akianonymus/google-drive-upload/raw/wip/install.sh | sh -s -- -c test_gupload -B wip -r Akianonymus/google-drive-upload

Como gerar contas de serviço: https://github.com/Akianonymus/google-drive-upload/tree/wip#generating-service-account-credentials Como usar: https://github.com/Akianonymus/google-drive-upload/tree/wip#for-service-accounts Teste e relatório.

Eu configurei a conta de serviço, gerei a chave e baixei o arquivo .json. Fico informado disso com a sintaxe -sa está correto, certo?

-> test_gupload -sa /root/backup_lapig_gdrive_chave_de_acesso.json folder_name

Estou enviando os dados, mas não aparecem na minha conta do google drive, tentei navegar na unidade mas não consegui encontrar, ao tentar acessar o link que gera acesso após subir, ele pede para solicitar acesso ao dono, estou confuso

The crazy thing is that the file went up and generated an access link, but when I access it asks to request access and I can't find it on my drive.

renatowow14 commented 3 years ago

If I go up without using the -sa syntax it appears on my drive and the access link works.

Akianonymus commented 3 years ago

So, i did some work on this today.

Almost everything is working now.

About the files not appearing, well it's uploaded in the bot account so not accessible.

For that, use --share flag.

Now, to upload directly in your own account, you have to use the --rootdir option.

  1. Grab the client email from service account json.

  2. Make a folder on your own drive and give write permissions to that email.

Now, just upload using the -sa flag and use --rootdir "root dir id" to upload directly in your account.

One problem here is that the files owner will be the service account.

To change the owner, i will soon introduce a flag.

mystix commented 2 years ago

Was this feature ever merged into master?