Score:0

How to redirect gsutil/gcloud stdout without elevated permissions

in flag
jws

On Ubuntu 20.04, I'm trying to capture stdout of gsutil ls, but oddly it gives me a permission error.

$ gsutil ls -b gs://my-bucket > /tmp/x.txt
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
PermissionError: [Errno 13] Permission denied

Same error trying to redirect gcloud. Both utilities are installed via snap.

I have no problem with

$ echo foo > /tmp/x.txt
$ cat /tmp/x.txt
foo

or with something like kubectl get all > /tmp/x.txt.

I've also tried other paths, such as ./x.txt or ~/scratch/x.txt that have wide open permissions. And I've made sure the file doesn't initially exist.

I can gsutil ls -b gs://my-bucket | tee /tmp/x.txt but that's not what I want.

Why can't I redirect stdout for the Google utilities without elevated permissions?

update this morning I realized I had only tried this in the VS Code terminal, and wow! it only reproduces there. I filed a bug.

Jofre avatar
vn flag
https://github.com/microsoft/vscode/issues/138265
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.