Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to files denied #3774

Closed
iamso opened this issue Feb 19, 2017 · 5 comments
Closed

Access to files denied #3774

iamso opened this issue Feb 19, 2017 · 5 comments

Comments

@iamso
Copy link

iamso commented Feb 19, 2017

Hi

In your minio shopping app demo you create a public link to the image. I have copied this line of code and tried this with my minio installation and I get an access denied error.

var publicUrl = minioClient.protocol + '//' + minioClient.host + ':' + minioClient.port + '/' + minioBucket + '/' + obj.name

Expected Behavior

I would expect to see the image in the browser when accessing the url.

Current Behavior

I get the following error:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>AccessDenied</Code>
    <Message>Access Denied.</Message>
    <Key></Key>
    <BucketName></BucketName>
    <Resource>/testbucket/IMG_0278.JPG</Resource>
    <RequestId>3L137</RequestId>
    <HostId>3L137</HostId>
</Error>

Steps to Reproduce (for bugs)

  1. install minio with homebrew brew install minio
  2. start the service brew services start minio (fix the .plist file before ;))
  3. log in to the web interface
  4. create a bucket
  5. upload a file
  6. use the node.js minio client, initialize client with server credentials
  7. and add the following code:
var stream = minioClient.listObjects(minioBucket,'', true)
stream.on('data', function(obj) {
  // Lets construct the URL with our object name.
  var publicUrl = minioClient.protocol + '//' + minioClient.host + ':' + minioClient.port + '/' + minioBucket + '/' + obj.name
  console.log(publicUrl);
});
  1. copy the generated url and paste it into the browser

Context

I was trying to load a file through the browser, like you do in the shopping app demo.

Your Environment

  • Version used: 2017-02-16T01:47:30Z
  • Environment name and version (e.g. nginx 1.9.1): with and without MAMP PRO 4 as proxy
  • Server type and version: MAMP PRO 4.1
  • Operating System and version: macOS Sierra

What could this be? Do I have to change something?

Thanks

@iamso
Copy link
Author

iamso commented Feb 19, 2017

Never mind, I found it. 😊

For those having the same issue, either use the command line client to set the policy for the bucket to public, more here, or use the web interface, where you click on the three dots next to the bucket name and add a row with the prefix * and Read and Write permissions.

@Sherriluneau
Copy link

Sherriluneau commented May 22, 2019

It was a sad day once i got threw access denied

@thienly
Copy link

thienly commented May 26, 2019

i got the same issue even though i set public permission for the bucket

@rcermeno
Copy link

Never mind, I found it.

For those having the same issue, either use the command line client to set the policy for the bucket to public, more here, or use the web interface, where you click on the three dots next to the bucket name and add a row with the prefix * and Read and Write permissions.

@iamso how to do this same but from mc cli?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 26, 2022
@cniackz
Copy link
Contributor

cniackz commented Apr 11, 2022

Hello @rcermeno

In order to do that, you can do this: mc policy set public myminio/bucket where myminio is the alias

Example:

$ mc policy get myminio/bucket
Access permission for `myminio/bucket` is `private`
$ mc policy set public myminio/bucket
Access permission for `myminio/bucket` is set to `public`
$ mc policy get myminio/bucket       
Access permission for `myminio/bucket` is `public`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants