1

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
6

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.

0
1

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

3
  • I am getting the following error :chown cannot access permission denied
    – Callat
    Mar 26 '17 at 23:06
  • 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
    Mar 26 '17 at 23:16
  • 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.
    – Callat
    Mar 28 '17 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.