允许其他用户使用S3FS存储桶目录

Pet*_*rus 11 s3fs

我在使用S3FS时遇到问题.我正在使用

ubuntu@ip-x-x-x-x:~$ /usr/bin/s3fs --version
Amazon Simple Storage Service File System 1.71
Run Code Online (Sandbox Code Playgroud)

我有装在密码文件/usr/share/myapp/s3fs-password600许可.

我成功安装了S3存储桶.

sudo /usr/bin/s3fs -o allow_other -opasswd_file=/usr/share/myapp/s3fs-password -ouse_cache=/tmp mybucket.example.com /bucket
Run Code Online (Sandbox Code Playgroud)

我已经user_allow_other启用了/etc/fuse.conf

当我尝试在存储桶中创建文件时,root它正常工作.

ubuntu@ip-x-x-x-x:~$ sudo su
root@ip-x-x-x-x:/home/ubuntu# cd /bucket
root@ip-x-x-x-x:/bucket# echo 'Hello World!' > test-`date +%s`.txt
root@ip-x-x-x-x:/bucket# ls
test-1373359118.txt
Run Code Online (Sandbox Code Playgroud)

我检查了存储桶mybucket.example.com的内容,文件已成功创建.

但是我在/bucket以不同的用户身份写入目录时遇到了困难.

root@ip-x-x-x-x:/bucket# exit
ubuntu@ip-x-x-x-x:~$ cd /bucket
ubuntu@ip-x-x-x-x:/bucket$ echo 'Hello World!' > test-`date +%s`.txt
-bash: test-1373359543.txt: Permission denied
Run Code Online (Sandbox Code Playgroud)

我拼命想尝试777一下test-1373359118.txt.我可以写入文件

ubuntu@ip-x-x-x-x:/bucket$ sudo chmod 777 test-1373359118.txt
ubuntu@ip-x-x-x-x:/bucket$ echo 'Test' > test-1373359118.txt
ubuntu@ip-x-x-x-x:/bucket$ cat test-1373359118.txt
Test
Run Code Online (Sandbox Code Playgroud)

有趣的是,我可以在存储桶中创建一个目录,将chmod设置为777,然后在那里写一个文件.

ubuntu@ip-x-x-x-x:/bucket$ sudo mkdir -m 1777 test
ubuntu@ip-x-x-x-x:/bucket$ ls
test  test-1373359118.txt
ubuntu@ip-x-x-x-x:/bucket$ cd test
ubuntu@ip-x-x-x-x:/bucket/test$ echo 'Hello World!' > test-`date +%s`.txt
ubuntu@ip-x-x-x-x:/bucket/test$ ls
test-1373360059.txt
ubuntu@ip-x-x-x-x:/bucket/test$ cat test-1373360059.txt
Hello World
Run Code Online (Sandbox Code Playgroud)

但后来我试过了

ubuntu@ip-x-x-x-x:~$ sudo chmod 777 /mybucket
chmod: changing permissions of '/mybucket': Input/output error
Run Code Online (Sandbox Code Playgroud)

它没用.

最初我正在考虑使用这个/bucket目录来存储来自位于几台EC2机器的LAMP堆栈中的大型且很少访问的文件.(我认为使用AWS PHP SDK而不使用特殊处理库就可以使用它,但这不是重点.)

由于这个原因,我可以使用内部的目录/mybucket来存储文件.但我只是好奇是否有办法让整个/mybucket其他用户?

cod*_*ark 15

对于旧版本的S3FS,权限是一个问题.升级到最新版本以使其正常运行.

正如问题本身和其他答案中所述,安装时您必须传递以下参数: -o allow_other

例:

s3fs mybucket:/ mymountlocation/ -o allow_other 
Run Code Online (Sandbox Code Playgroud)

此外,在执行此操作之前,请确保启用以下内容/etc/fuse.conf:

user_allow_other
Run Code Online (Sandbox Code Playgroud)

它默认是禁用的;)

  • 这似乎不能递归工作,这意味着即使设置了“allow_other”选项(以及“user_allow_other”),我也无法访问 S3 存储桶中的子目录 (4认同)

Chr*_*ris 7

这对我有用:

s3fs ec2downloads:/ /mnt/s3 -o use_rrs -o allow_other -o use_cache=/tmp
Run Code Online (Sandbox Code Playgroud)

它必须已在最近的版本中修复,我正在使用github项目中的最新克隆(1.78).


Pau*_*aul 1

我想推荐看一下新项目 RioFS(用户空间 S3 文件系统):https://github.com/skoobe/riofs

\n\n

该项目是 \xe2\x80\x9cs3fs\xe2\x80\x9d 的替代方案,与 \xe2\x80\x9cs3fs\xe2\x80\x9d 相比的主要优点是:简单、操作速度快和无错误代码。目前该项目处于 \xe2\x80\x9ctesting\xe2\x80\x9d 状态,但它已经在几个高负载文件服务器上运行了相当长的一段时间。

\n\n

我们正在寻找更多的人加入我们的项目并帮助进行测试。从我们这边,我们提供快速错误修复,并将听取您添加新功能的请求。

\n\n

关于您的问题,为了以 root 用户身份运行RioFS并允许其他用户对挂载目录具有读/写访问权限:

\n\n
    \n
  1. 确保 /etc/fuse.conf 包含 user_allow_other 选项
  2. \n
  3. 使用 -o "allow_other" 参数启动 RioFS。
  4. \n
\n\n

启动 RioFS 的整个命令行如下所示:

\n\n
sudo riofs -c /path/to/riofs.conf.xml http://s3.amazonaws.com mybucket.example.com /bucket\n
Run Code Online (Sandbox Code Playgroud)\n\n

(确保您导出了AWSACCESSKEYIDAWSSECRETACCESSKEY变量或将它们设置在riofs.conf.xml配置文件中)。

\n\n

希望它对您有所帮助,我们期待您加入我们的社区!

\n