Confused about how to manipulate GCS bucket/object permissions

us flag

On my laptop I have a directory which contains a subdirectory, which in turn contains a bunch of HTML files. It looks like this:

% ls -lR 2000-09
total 12
drwxrwxr-x 2 skip skip 12288 Nov 18 07:42 html

total 648
-rw-r--r-- 1 skip skip 18489 Dec  4  2019 index.html
-rw-r--r-- 1 skip skip 18489 Dec  4  2019 maillist.html
-rw-r--r-- 1 skip skip  3468 Dec  4  2019 msg00000.html
-rw-r--r-- 1 skip skip  3270 Dec  4  2019 msg00001.html
-rw-r--r-- 1 skip skip  3194 Dec  4  2019 msg00002.html

I use gsutil to upload that directory to my bucket:

% gsutil -m cp -r 2000-09 gs://my-secret-bucket/
Copying file://2000-09/html/msg00070.html [Content-Type=text/html]...
Copying file://2000-09/html/msg00060.html [Content-Type=text/html]...           
Copying file://2000-09/html/msg00029.html [Content-Type=text/html]...           
Copying file://2000-09/html/msg00052.html [Content-Type=text/html]...           

It looks fine through the console. I see 2000-09, inside that html, and inside that a bunch of files. So far, so good.

Now I open up a cloud shell and mount that bucket using gcsfuse:

gcsfuse my-secret-bucket ~/mnt

but the resulting directory view appears empty:

me@cloudshell:~ (whatever)$ ls -l ~/mnt
total 0
me@cloudshell:~ (whatever)$

Then I upload a couple files directly into my bucket (at the top level)

% gsutil -m cp wrench?.jpg gs://my-secret-bucket/
Copying file://wrench1.jpg [Content-Type=image/jpeg]...
Copying file://wrench2.jpg [Content-Type=image/jpeg]...                         
/ [2/2 files][  1.0 MiB/  1.0 MiB] 100% Done                                    
Operation completed over 2 objects/1.0 MiB.

I confirm that they are there in the console, then list my mounted bucket again. They are visible and I can read them:

$ ls -l ~/mnt
total 1049
-rw-r--r-- 1 me me 432451 Nov 18 19:09 wrench1.jpg
-rw-r--r-- 1 me me 640526 Nov 18 19:09 wrench2.jpg
me@cloudshell:~ (whatever) cksum mnt/wrench1.jpg
3659533210 432451 mnt/wrench1.jpg
me@cloudshell:~ (whatever)$

It seems that files are visible at the top level, but I can't figure out how to make the directory and its contents visible. The web interface is extremely confusing for an old Unix guy like me who wants to see stuff like rw-r--r-- when viewing long listings and execute chmod 0644 ... to make it so when it doesn't look right. How do I make my 2000-09 object/folder/directory and (recursively) its entire contents visible? Ultimately, I want to have it visible to a GCP-hosted Flask web app (also owned by me, so not necessarily publicly visible).

sh flag

According to this related thread, gcsfuse by default might not show directories that were not created directly. I tried doing the exact steps you described, and my directories were not visible from the mounted folder (top level files did show up correctly). The same answer explains that using the --implicit-dirs flag changes this behavior to show the directories. I created another mount with the flag, and the folders were visible from Cloud Shell:

gcsfuse --implicit-dirs BUCKET_NAME ~/mountedDir

For mounting the storage bucket on a directory, I used the gcsfuse documentation, which goes into detail about mounting procedures. It is important to review the possible side effects from using this flag, such as additional API calls.

us flag
Dang, nice! I have been drowning in a sea of Google Cloud pages trying to figure this out. --implicit-dirs solved my problem. It doesn't work yet from my Linux laptop, but that clearly seems to be a more straightforward problem related to missing credentials.

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.