Warning message

This translation is outdated. For the most up-to-date information, please refer to the English version.

CIFS を使用して Red Hat Enterprise Linux システムに Windows 共有をマウントする方法

Solution 確認済 - 更新日時 - 翻訳の更新依頼

環境

  • Red Hat Enterprise Linux (RHEL)
  • CIFS

問題

  • Windows 共有を Red Hat Enterprise Linux にマウントするにはどうすればよいでしょうか?

解決策

  • 次のコマンドを実行するには、mount.cifs ヘルパープログラムを提供する cifs-utils パッケージをインストールする必要があります。CIFS ボリュームをマウントするための一部のコマンドでは mount() システムコールを発行する前に、ヘルパープログラムがオプションを前処理する必要があります。
  • Windows 共有は、次のように mount コマンドの cifs オプションを使用して RHEL システムにマウントできます。

    # mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt
    
  • サーバーがマルチバイト文字セットを使用している場合は、iocharset を指定してローカルパス名を UTF-8 に変換できます。

    # mount -t cifs -o iocharset=cp932,username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt
    
  • ユーザーが Windows ドメイン内で操作している場合は、次のようにドメインを定義できます。

    # mount -t cifs -o username=<share user>,password=<share password>,domain=example.com //WIN_PC_IP/<share name> /mnt
    
  • デフォルトでは、Windows 共有は Linux に完全な権限 (0755) でマウントされます。デフォルトの権限を変更するには、dir_mode および file_mode オプションを使用して、ディレクトリーとファイルの権限を設定します。

    # mount -t cifs -o username=<share user>,password=<sharepassword>,dir_mode=0755,file_mode=0755 //WIN_PC_IP/<share name> /mnt
    
  • 再起動後もマウントを永続化するには、/etc/fstab に以下のエントリーを追加します。

    //WIN_PC_IP/<share name>    /<mntpoint>   cifs  _netdev,username=<share user>,password=<share password>,dir_mode=0755,file_mode=0755,uid=500,gid=500 0 0
    
  • ユーザー名/パスワード/ドメインが必要な場合は、fstab に残さない方がよいでしょう。これを実現するには、前のエントリーを次のように変更します。

    //WIN_PC_IP/<share name>    /<mntpoint>   cifs  _netdev,credentials=/root/.credfile,dir_mode=0755,file_mode=0755,uid=500,gid=500 0 0
    

    次に、次の内容のファイル /root/.credfile を作成します (domain は必須ではない場合があります)。

    username=<share user>
    password=<share password>
    domain=<share domain>
    
  • Windows マシンから共有フォルダーをマウントしようとしたときに次のエラーが表示される場合:

    mount error(13): Permission denied
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    

    Windows マシン上のフォルダーの権限を確認し、共有フォルダーのマウントを再度試してください。

原因

  • 詳細は、MOUNT.CIFS(8) を参照してください。

診断手順

  • コンポーネント
  • samba

このソリューションは、Red Hat のエンジニアがお客様のサポート中に作成したナレッジコンテンツの大型ライブラリーを提供する Fast-Track Publication Program の一環です。お客様が必要とする知識・情報を即時に提供するために、これらの記事は、未処理・未編集の状態で提示される場合がありますので、予めご了承ください。

コメント