# การ set ACL สำหรับการเปิดใช้งาน Objects แบบ public

## การตั้ง ACL ให้ objects สำหรับต้องการใช้งานแบบ public

ใช้คำสั่ง s3cmd setacl แล้วใส่ flag --acl-public โดยข้อมูลที่ต้องการมีดังนี้

* ชื่อ Bucket ( BUCKET )
* ชื่อ Object ที่ต้องการให้ใช้งานแบบ public ( OBJECT )

```bash
s3cmd setacl s3://BUCKET[/OBJECT] --acl-public
```

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2Fue2TsQTOtyJGiJcDnFLY%2FScreenshot%202566-11-16%20at%2016.44.11.png?alt=media&#x26;token=dba64c21-dd71-478b-b073-ba32253c332d" alt=""><figcaption></figcaption></figure>

ทดสอบด้วยการ curl จะสามารถเรียกดูข้อมูลภายใน Object นั้นได้

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FyMiRgGKyVA0q7D96TMtq%2FScreenshot%202566-11-16%20at%2016.45.26.png?alt=media&#x26;token=98101fa7-de1b-4250-a384-45ee180dd5da" alt=""><figcaption></figcaption></figure>

หาต้องการปิดการใช้งานแบบ public ให้ใส่ flag --acl-private

```bash
s3cmd setacl s3://BUCKET[/OBJECT] --acl-private
```

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FJWPbtzrHQcMM1CkbimTs%2FScreenshot%202566-11-16%20at%2016.45.34.png?alt=media&#x26;token=9c435976-fb7c-4b7e-a24c-4ba80690cf36" alt=""><figcaption></figcaption></figure>

ทดสอบด้วยการ curl จะต้องไม่สารมารถเรียกดูข้อมูลได้เนื่องจาก AccessDenied

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FlA7goiMXcqWIHkJmpZ3m%2FScreenshot%202566-11-16%20at%2016.45.52.png?alt=media&#x26;token=25c4f190-fcf3-4ec8-bf0a-c745f164a7d3" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/storage/object-storage-s3/access-s3-bucket-with-s3cmd/set-acl-objects-public.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
