Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I installed s3fs, a tool that allows mounting Amazon S3 buckets as a file system. I created folder for mounting in /mnt/s3 then I created a file in /etc/passwd-s3fs with the content BucketName:AccessKeyId:SecretAccessKey but I still can't access it, and the error is:

s3fs: could not determine how to establish security credentials

Am I missing something?

share|improve this question
    
Looking at the code, if it cannot parse the credential file in its default location, it silently falls through to that error. But, if you put that same file's path into the environment variable AWS_CREDENTIAL_FILE or pass on the command line, it will report "is not readable" if it fails to parse. –  Tim B Jul 12 '13 at 17:01
    
Hi Tim, Could you please give me more explanation ? –  Khalid Jul 13 '13 at 10:11
    
and now the error is "s3fs: specified passwd_file is not readable", do you know what is that mean ? –  Khalid Jul 13 '13 at 13:51
    
The code opens a stream to read the file. Before it passes the stream to the method that reads the content, it checks for errors on the stream. My guess is that the user trying to mount doesn't have permission to read the file. Try running "chmod 666 /etc/passwd-s3fs" to make it world readable to debug. Then be sure to set ownership and permissions to something more reasonable from a security perspective. (anyone reading your credentials from that file can then use your AWS S3 account) –  Tim B Jul 14 '13 at 3:23

2 Answers 2

For Amazon s3fs you have two options for credentials: root or per user.

For a root setup you would place your credentials in here:

/etc/passwd-s3fs

And then make sure the permissions to that file are 640 like this:

sudo chmod 640 /etc/passwd-s3fs

The contents of that file should simply be [AccessKey]:[SuperSecretKey] with those two values substituted for your real access key and super secret key. Note I did not prefix the “bucket” name as you have in your example. I would recommend just seeing if you can access the S3 stuff to begin with for testing.

If you want to do user level credentials, that would be placed in the home folder of the user who would need to have s3fs access. So it would if this were for you, it would be in here:

nano ~/.passwd-s3fs

The contents of the file would be the same as /etc/passwd-s3fs but the permissions would be different. So make sure those permissions are 600 like this:

chmod 600 ~/.passwd-s3fs

Then as far as mounting goes, this is how you would mount the contents if you are root:

sudo s3fs [BucketName] /mnt/s3

Be sure to change the bucket name to match the actual bucket you wish to mount. And to run that on a per user basis using the ~/.passwd-s3fs credentials, just run the same command without sudo like this:

s3fs [BucketName] /mnt/s3

To unmount the mounted bucket, just do this:

sudo umount /mnt/s3

Or do this if you are using a per-user setup:

umount /mnt/s3
share|improve this answer

Looking at the code, it opens a stream to read the file. Before it passes that stream to the method that reads the content, it checks for errors on the stream. My guess is that the user trying to mount doesn't have permission to read the file.

The right way to fix this is to give that config file the proper ownership and permissions if you can determine what it should be. If you cannot, you can open up the permissions to make it readable by everyone as a test.

Try running chmod 666 /etc/passwd-s3fs to make it world readable and see if that allows you to mount. Note that some programs (such as OpenSSH) are written to warn or fail if config files have permissions that are not restrictive enough. I only looked quickly, but didn't see that in s3fs.

Once you confirm the config file is correct, you must then set ownership and permissions to something more reasonable from a security perspective. Anyone reading your credentials from that file can then use your AWS S3 account.

share|improve this answer
    
yes you right, and thanks to you now I can mount my folder, but another problem, after pass your instructions above and I list my mount folder, that exist, and the result is : (s3fs@fuse0 on /mnt/s3 (fuse4x, synchronous) ), but when i wish to list /mnt/s3, the result (ls: /mnt/s3: No such file or directory), so any idea with this ? –  Khalid Jul 15 '13 at 12:00
    
it is because mounting point previllage on fstab ? but I can't figure to change fstb on lion, I alredy tried use (sudo vifs) but it does'nt change anyting. i don;t know –  Khalid Jul 15 '13 at 14:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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