Table of Contents
Open Table of Contents
描述
預設在建立 bucket 時,預設權限為僅限自己存取,因此你分享的連結只有自己能存取,因此你可能會遇到分享連結給其他人,卻無法存取的情況,若想要讓所有人都能公開存取,則要調整對應的權限設定
1️⃣ 將整個 bucket 設定為公開存取
- 建立 bucket 時,取消勾選 Enforce public access prevention on this bucket
- 確定 bucket 的 Permissions 設定有正確的 Public access 設定
- 點擊 bucket 列表右方的
...
按鈕,選擇 Edit access - 點擊 Add principal
- 在 New principals 欄位輸入
allUsers
和 Role 欄位選擇 Storage Object Viewer - 點擊 Save 和 Allow public access 按鈕
- 在 bucket 列表中,你會看到預期的 Public access 設定
- 完成設定,現在你在 bucket 中的檔案連結可以公開存取給所有使用者 🎉
2️⃣ 僅開放特定檔案公開存取
- 建立 bucket 時,取消勾選 Enforce public access prevention on this bucket
- 建立 bucket 時,Access control 的權限選擇 Fine-grained
- 確定 bucket 的 Permissions 設定有正確的 Public access 設定
- 確定 bucket 的 Permissions 設定有正確的 Public access 設定
- 點擊特定檔案的 Edit access
- 點擊 Add entry,並新增
allUsers
的 Public read 權限 - 在檔案列表中,你會看到預期的 Public access 設定
- 完成設定,現在這個檔案的連結可以公開存取給所有使用者 🎉