Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to hide the file listing index page of a MinIO bucket?

Tags:

minio

I have set a MinIO bucket's access permission to "download" so that files can be read (but not written) by anyone, but this has enabled an "index page" that shows the contents of the entire bucket. For example, consider the bucket store/test that contains the file example.png. I would like example.png to be readable by the world wide web, so I set the access permission for store/test to "download", which means that https://store.example.com/test/example.png is now readable by anyone, but it also means that https://store.example.com/test now shows a listing of all files in the bucket:

<!-- Pretty printed result of $ curl https://store.example.com/test -->
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Name>test</Name>
  <Prefix/>
  <Marker/>
  <MaxKeys>4500</MaxKeys>
  <Delimiter/>
  <IsTruncated>false</IsTruncated>
  <Contents>
    <Key>example.png</Key>
    <LastModified>2021-02-05T08:13:06.683Z</LastModified>
    <ETag>"7c8b827ef97e929258e9728cb96059cf-33"</ETag>
    <Size>4295413012</Size>
    <Owner>
      <ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
      <DisplayName/>
    </Owner>
    <StorageClass>STANDARD</StorageClass>
  </Contents>
</ListBucketResult>

I don't want to show this listing page, but I do want all files in the bucket to be world-readable, including files that are added to the bucket later. How can this be achieved?

like image 501
luawtf Avatar asked Sep 02 '25 17:09

luawtf


1 Answers

If my bucket name is file

mc policy set none myminio/file
mc policy set download myminio/file/*
like image 86
Hadi Rasekh Avatar answered Sep 05 '25 06:09

Hadi Rasekh