FuseFSの実行ユーザ限定アクセスを解除

FuseFSで構築したファイルシステムは初期設定のままだと、スクリプト実行ユーザしかFuseFSファイルシステムにアクセスできない。この制限の解除の仕方をメモ。

FuseFSの初期設定のままの問題点

たとえば。。。サンプルスクリプトの hello.rb だと。

% whoami
user1
% pwd
/home/user1
% ls -l
合計 8
-rw-r--r-- 1 user1 user1  329 2005-10-11 16:23 hello.rb
drwxr-xr-x 2 user1 user1 4096 2007-11-06 23:21 mnt
% ruby hello.rb mnt
(プロンプト返ってこない)

別端末の別ユーザでログインして、mntにアクセスを試みると。。。

% whoami
user2
% cd /home/user1
% ls
% ls -l
合計 4
-rw-r--r-- 1 user1 user1  329 2005-10-11 16:23 hello.rb
?--------- ? ?     ?      ?                  ? mnt
% ls mnt
ls: mnt: 許可がありません
%

っといった感じ。実はこれは、FuseFSのソースをダウンロードすると、API.txtってのがついてきて、そのAPI.txtの中にこれに関する記述が載っていた。

解法


  1. /etc/fuse.conf を以下の内容で作成する。(初期設定ではこのファイルは作成されない)

    % cat /etc/fuse.conf
    user_allow_other
    %



  2. ソースコードを少し書き換える。hello.rbを編集しましょう。
    マウントポイントを指定する部分にて。。。

    # Mount under a directory given on the command line.
    FuseFS.mount_under ARGV.shift
    FuseFS.run

    と書いてあるところを。。。

    # Mount under a directory given on the command line.
    FuseFS.mount_under ARGV.shift, 'allow_other'
    FuseFS.run



  3. これでうまくいっているはずです。動作確認を行ってください

以上でした。
メモメモ