You must run the cron job in the Google compute engine (gce) to take a gcloud snapshot with the service account

I managed to create and execute a snapshot of the script if I use gcloud auth to use my personal account. but if I have cron run as root or as the selected user, nothing happens during cron.

I used this script https://gist.github.com/peihsinsu/73cb7e28780b137c2bcd and it works great, and as the author notes: "Install gcloud and auth first",

My problem is using my personal account, not the service account.

When you run gcloud auth login, you get a very important message

Your credentials may be visible to others who have access to this virtual machine. Are you sure you want to authenticate using your personal account?

Any thoughts or suggestions to avoid this security risk.

+4
source share
1 answer

It's time to figure it out. the script is valid. The hard part is user rights. There are 2 types of users - OS user and GCE user.

gcloud GCE, , , blabla@gmail.com. , GCE. ( Bitnami) ( root!!!).

, :

  • gcloud GCE ( gcloud config set blabla@gmail.com)
  • script (chmod + x)
  • script , GCE
  • cron ( sudo -u bitnami crontab -e)
  • script crontab
+1

Source: https://habr.com/ru/post/1569481/


All Articles