GNU/Linux >> Linux の 問題 >  >> Linux

sshfs と書き込みファイル権限でマウントする

質問は Linux メーリング リストで回答されました。完全を期すために、ここに翻訳された回答を投稿します。

解決策

解決策は、両方のオプション default_permissions を使用しないことです と allow_other (最初の実験では試しませんでした)。

説明

問題は非常に単純なようです。オプション default_permissions を指定すると fusermount では、ヒューズ マウントのヒューズの許可制御は、カーネル によって処理されます。 ヒューズではなく .これは、REMOTE_USER の uid/gid が LOCAL_USER (sshfs.c IDMAP_NONE) にマップされていないことを意味します。マッピングなしの単純な nfs fs と同じように機能します。

そのため、uid/gid 番号が一致しない場合、アクセスを禁止することは理にかなっています。

オプション allow_other がある場合 このディレクトリは、存在する場合、uid 699 を持つローカル ユーザーのみが書き込み可能です。

布施の男より:

'default_permissions'

   By default FUSE doesn't check file access permissions, the
   filesystem is free to implement its access policy or leave it to
   the underlying file access mechanism (e.g. in case of network
   filesystems).  This option enables permission checking, restricting
   access based on file mode.  It is usually useful together with the
   'allow_other' mount option.

'allow_other'

   This option overrides the security measure restricting file access
   to the user mounting the filesystem.  This option is by default only
   allowed to root, but this restriction can be removed with a
   (userspace) configuration option.

sudo で sshfs を実行しないでください。これを行うと、ssh はファイル システムがルートに属していると見なします。自分で実行すると、ファイルに書き込めるようになります。

説明

sudo なしで実行する場合、おそらく /mnt に書き込むことができないため、独自のディレクトリにマウントする必要があります。 /etc/fuse.conf に user_allow_other を追加した後の sshfs の使用例を次に示します。

$ cd                      # make sure you are in home directory
$ mkdir mnt               # create empty directory
$ sshfs server.com: mnt   # mount my home directory on server.com on ./mnt
$ ls mnt
[contents of home directory on server]
$ touch mnt/new_file      # no problem creating a new file
$ fusermount -u mnt       # unmount file system
$ rmdir mnt

考えられる理由の 1 つは、マウントしたディスクに空き容量がなくなったことです。


Linux
  1. Linux のファイル権限 – 読み取り/書き込み/実行

  2. LinuxでCでファイルを書く方法は?

  3. Git でファイルのアクセス許可を保持する

  1. スペースを含む AWK およびファイル名。

  2. rsync を使用してファイルとフォルダーのアクセス許可を保持する

  3. sudo / rootなしでループバックファイルをマウントして変更することは可能ですか?

  1. Smb 2.0以降とのSamba共有でUnixファイルのアクセス許可を有効にする方法は?

  2. Linux – Mount Cifsネットワークドライブ:書き込み権限とChown?

  3. cifs ネットワーク ドライブのマウント:書き込み権限と chown