S3fs can't access bucket permission denied

6,287

Solution 1

Since I found a fix for this I feel obligated to share it sense I asked for help.

What worked for me was fixing my permission immediately via the mount command like so:

s3fs babylon ~/MyMount -o passwd_file=~/.passwd-s3fs -o umask=0000

Umask works like a subtractor so with all 0s it sets things to 777. When I open my bucket via a script I made I now see the following:

-rwxrwxrwx 1 kaz  kaz       0 Mar 26 03:11 drfg.txt
-rwxrwxrwx 1 kaz  root   2272 Mar 26 19:48 lab8.cpp
-rwxrwxrwx 1 kaz  kaz      16 Mar 24 22:44 nextday.txt
-rwxrwxrwx 1 kaz  root 814493 Mar 26 19:48 Refactoring - A good example.pdf
-rwxrwxrwx 1 root root 522010 Mar 26 20:06 revy_3.jpg
-rwxrwxrwx 1 kaz  root    586 Mar 26 19:49 sample.c
-rwxrwxrwx 1 kaz  kaz       6 Mar 26 01:29 temp.txt

I hope that this helps anyone struggling with s3fs.

Solution 2

As you can see from:

---------- 1 root root 2272 Mar 25 21:47 lab8.cpp
-rw-rw-r-- 1 kaz kaz 16 Mar 24 22:44 nextday.txt
---------- 1 root root 586 Mar 20 13:27 sample.c
-rw-rw-r-- 1 kaz kaz 6 Mar 26 01:29 temp.txt

The files are owned by root, so you have to change the ownership of those files.

To change the ownership of a directory and any file in it, recursively:

chown $USER -R /path/to/directory

In your case it should be sudo chown $USER -R ~/MyMount

Share:
6,287

Related videos on Youtube

Callat
Author by

Callat

I'm your avg nerd and new programmer I'm out to learn new software so that when the machines take over the world, I can take over the machine. "Knowledge is not enough, one must apply" Bruce Lee

Updated on September 18, 2022

Comments

  • Callat
    Callat over 1 year

    I have installed s3fs and made a bucket with aws S3. I am able to write to it. But when I upload a file to the bucket and try reading it I get the following error.

    You do not have the permissions necessary to open the file.

    I've tried chmod 777 and I don't have permissions, I've tried sudo and I still don't have permissions.

    I mount my drive by typing the following line:

    s3fs babylon ~/MyMount -o passwd_file=~/.passwd-s3fs
    

    How can I get permissions to access my files? Looking at them with ls -l I see the following:

    ~/MyMount$ ls -l
    total 5
    ---------- 1 root root 2272 Mar 25 21:47 lab8.cpp
    -rw-rw-r-- 1 kaz  kaz    16 Mar 24 22:44 nextday.txt
    ---------- 1 root root  586 Mar 20 13:27 sample.c
    -rw-rw-r-- 1 kaz  kaz     6 Mar 26 01:29 temp.txt
    
  • Callat
    Callat about 7 years
    I am getting the following error :chown cannot access permission denied
  • Callat
    Callat about 7 years
    Ok so something went wrong with my mount script that I'm trying to make but now I am getting a different error: Operation not permitted and for some files I get Input/Output error
  • Callat
    Callat about 7 years
    I've determined that the reason why that doesn't work is because root doesn't have any sort of permissions at all so chown fails because even though root owns it, it cannot be accessed.