23

All of a sudden I started getting "Permission Denied" issues when trying to run any gcloud commands such as gcloud components update -- the issue was avoided if I ran sudo gcloud components update but it's not clear to my why the sudo command is suddenly required? I have actually been trying to run a GCMLE experiment and it had the same error/warning, so I tried updating components and still ran into this issue. I have been travelling for a couple days and did not make any changes since these same commands worked a few days ago. Further, I did not changed my OS (Mac High Sierra 10.13.3) -- were there any changes on the Google side that might explain this change in behavior? What is the best course of action to permanently get around this warning?

(conda-env) MacBook-Pro:user$ gcloud components update
WARNING: Could not setup log file in /Users/$USERNAME/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/Users/$USERNAME/.config/gcloud/logs/2018.03.10/XX.XX.XX.XXXXXX.log')

after sudo gcloud components update I was able to kick off a GCMLE experiment, but I also get the same warning (though my job now submits successfully).

WARNING: Could not setup log file in /Users/#USERNAME/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/Users/$USERNAME/.config/gcloud/logs/2018.03.10/XX.XX.XX.XXXXXX.log')
reese0106
  • 2,011
  • 2
  • 16
  • 46

2 Answers2

67

Based on an answer to a similar question, you probably need to change the permissions to the appropriate directories:

sudo chown -R $USER ~/.config/gcloud

That same post suggests that permissions may have gotten out-of-whack by running a gcloud command with sudo.

Dennis
  • 4,011
  • 7
  • 36
  • 50
rhaertel80
  • 8,254
  • 1
  • 31
  • 47
  • that works - but for some reason, that error keeps coming back after some time. Could it be something with Docker / Skaffold, and that it's using `sudo` for its operations? – avloss Nov 09 '19 at 10:04
  • fantastic. Combed the internet looking for a solution and this did the trick. Thanks – TheoNeUpKID May 08 '20 at 21:34
  • this seems to happen after I update as per: ```sudo gcloud components update``` – Jas Jun 23 '20 at 10:33
10

In most cases, the problem is not caused by the ~/.config/gcloud directory but the installation directory of gcloud which is owned by root: drwxr-xr-x 20 root staff 640 Jun 20 18:22 google-cloud-sdk

Solution: You must change permissions for that directory to your user from:

by: sudo chown -R $USER /Users/$USER/bin/google-cloud-sdk

Agile Bean
  • 6,437
  • 1
  • 45
  • 53