Translated message

A translation of this page exists in English.

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

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL)
  • CIFS

Issue

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

Resolution

  • 次のコマンドを実行するには、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 マシン上のフォルダーの権限を確認し、共有フォルダーのマウントを再度試してください。

Root Cause

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

Diagnostic Steps

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments