web-dev-qa-db-ja.com

CIFSマウントポイントのアクセス許可を構成する

私のUbuntuマシンでは、/etc/fstabに次のものを含めることで、CIFS共有をマウントしています。

//netgear0/photos /media/netgear0-photos  cifs  credentials=/home/bob/passwd/netgear0-smb-cred,iocharset=utf8,uid=1000,gid=1000,rw  0  0

これにより、共有が正しくマウントされ、次のように表示されます。

drwxr-xr-x  1 bob  bob    0 2011-10-10 07:25 netgear0-photos

ただし、マウントポイントディレクトリのみのアクセス許可を700に変更して、bobのみがマウントポイント内のファイルを表示できるようにします。マウントする前にディレクトリに権限を設定しようとしましたが、マウント中に置き換えられます。マウントポイント内のアクセス許可を変更するためのオプションはありますが、マウントポイント自体を変更するためのオプションはありません。

4
Fae Hutter

SambaサーバーでCIFSUnix拡張が許可されている場合は、mickeの回答にnounixを追加する必要があります。,dir_mode=0700,file_mode=0700,nounix

これは、CIFS Unix拡張機能では、クライアントがモードをオーバーライドできないためです。非常に明確ではありませんが、 mount.cifsのmanページ に次のような参照があります。

   If the uid's and gid's being used do not match on the client and
   server, the forceuid and forcegid options may be helpful. Note however,
   that there is no corresponding option to override the mode. Permissions
   assigned to a file when forceuid or forcegid are in effect may not
   reflect the the real permissions.
6
qtwo

追加 ,dir_mode=0700,file_mode=0700オプションフィールド(rwの後)。

4
micke