Ubuntu: S3fs can't access bucket permission denied



Question:

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  


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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »