【发布时间】:2021-08-01 02:21:35
【问题描述】:
我在使用 S3FS 时遇到问题。我正在使用
ubuntu@ip-x-x-x-x:~$ /usr/bin/s3fs --version
Amazon Simple Storage Service File System 1.71
我在/usr/share/myapp/s3fs-password 中安装了密码文件,并具有600 权限。
我已成功挂载 S3 存储桶。
sudo /usr/bin/s3fs -o allow_other -opasswd_file=/usr/share/myapp/s3fs-password -ouse_cache=/tmp mybucket.example.com /bucket
我在/etc/fuse.conf 中启用了user_allow_other
当我尝试在存储桶中创建一个文件为 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
我查看了bucketmybucket.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
我拼命尝试 chmod 到 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
有趣的是,我可以在存储桶中创建一个目录,将 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
但后来我尝试了
ubuntu@ip-x-x-x-x:~$ sudo chmod 777 /mybucket
chmod: changing permissions of '/mybucket': Input/output error
没用。
最初我想使用这个/bucket 目录来存储来自我的 LAMP 堆栈的大型且很少访问的文件,这些文件位于几台 EC2 机器上。 (我认为在不使用 AWS PHP SDK 制作特殊处理库的情况下使用它就足够了,但这不是重点。)
由于这个原因,我可以使用/mybucket 中的目录来存储文件。但我只是好奇是否有办法允许其他用户使用整个/mybucket?
【问题讨论】:
标签: s3fs