2013-07-09 109 views
7

我遇到了使用S3FS的問題。我使用允許其他用戶使用S3FS桶目錄的權限

[email protected]:~$ /usr/bin/s3fs --version 
Amazon Simple Storage Service File System 1.71 

而且我有安裝在/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 

而且我已經在/etc/fuse.conf

啓用user_allow_other當我試圖創建在桶文件作爲root它的工作。

[email protected]:~$ sudo su 
[email protected]:/home/ubuntu# cd /bucket 
[email protected]:/bucket# echo 'Hello World!' > test-`date +%s`.txt 
[email protected]:/bucket# ls 
test-1373359118.txt 

我檢查了存儲桶mybucket.example.com的內容併成功創建了該文件。

但是我有寫作到目錄/bucket不同用戶的困難。

[email protected]:/bucket# exit 
[email protected]:~$ cd /bucket 
[email protected]:/bucket$ echo 'Hello World!' > test-`date +%s`.txt 
-bash: test-1373359543.txt: Permission denied 

我拼命搭配chmod-ING於777test-1373359118.txt。我可以寫入到文件

[email protected]:/bucket$ sudo chmod 777 test-1373359118.txt 
[email protected]:/bucket$ echo 'Test' > test-1373359118.txt 
[email protected]:/bucket$ cat test-1373359118.txt 
Test 

有趣地,我可以創建一個目錄桶內中,chmod設置爲777,並寫入文件存在。

[email protected]:/bucket$ sudo mkdir -m 1777 test 
[email protected]:/bucket$ ls 
test test-1373359118.txt 
[email protected]:/bucket$ cd test 
[email protected]x-x:/bucket/test$ echo 'Hello World!' > test-`date +%s`.txt 
[email protected]:/bucket/test$ ls 
test-1373360059.txt 
[email protected]:/bucket/test$ cat test-1373360059.txt 
Hello World 

但後來我嘗試

[email protected]:~$ sudo chmod 777 /mybucket 
chmod: changing permissions of '/mybucket': Input/output error 

它沒有工作。

起初,我想利用這個/bucket目錄從位於幾個EC2的機器我的LAMP堆棧存儲大量的,很少訪問的文件。 (我認爲在沒有使用AWS PHP SDK製作特殊處理庫的情況下使用它就足夠了,但這不是重點)。

由於這個原因,我可以使用/mybucket中的一個目錄來存儲文件。但我只是好奇,如果有一種方法可以讓整個/mybucket其他用戶?

回答

0

我想推薦給看看新項目RioFS(用戶空間文件系統S3):https://github.com/skoobe/riofs

該項目是「s3fs」另類,比較主要的優勢,以「s3fs」是:簡單,操作和錯誤無碼的速度。目前the project處於「測試」狀態,但它已在多個高負載文件服務器上運行了一段時間。

我們正在尋求更多的人加入我們的項目並幫助進行測試。從我們這邊,我們提供快速的錯誤修復,並會聽取您的請求以添加新功能。

關於您的問題,以便運行RioFS作爲根用戶,並允許其他用戶具有讀/寫訪問權限安裝目錄:

  1. 確保/etc/fuse.conf包含user_allow_other選項
  2. 使用-o「allow_other」參數啓動RioFS。

整個命令行啓動RioFS看起來像:

sudo riofs -c /path/to/riofs.conf.xml http://s3.amazonaws.com mybucket.example.com /bucket 

(請確保您導出兩個AWSACCESSKEYIDAWSSECRETACCESSKEY變量或設置他們riofs.conf.xml配置文件)。

希望它可以幫助你,我們期待着你的加入我們的社區!

+0

感謝您的建議。我會先看看這個。 –

1

可能有幾個原因,我列出了一個可能的原因,因爲我遇到了同樣的問題。如果你看看你的文件權限,它可能會繼承'---------' - 沒有權限/ ACL。

如果是這種情況,可以將「x-amz-meta-mode」添加到文件的元數據中。請檢查my post關於如何動態/動態執行。

+0

這是我的問題 - 我只是'chmod 777''ed它並得到了卸載。 –

6

這個工作對我來說:

s3fs ec2downloads:/ /mnt/s3 -o use_rrs -o allow_other -o use_cache=/tmp 

它必須被固定在最近的版本中,我使用的是最新的克隆(1.78)從github project

+3

沒有爲我工作。 :( – codersofthedark

0

如果你使用CentOS的需要啓用httpd_use_fusefs選項,否則不管你給什麼s3fs選擇它永遠不會有通過的httpd訪問

setsebool -P httpd_use_fusefs on 
7

權限是與舊版本S3FS的問題許可。升級到最新版本以使其工作。

正如已經在問題本身和其他的答案說,當安裝你將不得不通過以下參數:-o allow_other

例子:

s3fs mybucket:/ mymountlocation/ -o allow_other 

而且,在此之前請確保以下已啓用在/etc/fuse.conf

user_allow_other 

它默認禁用)

相關問題