Translated message

A translation of this page exists in English.

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 Verified - Updated -

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 5

Issue

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

Resolution

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

    # mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt
    
  • サーバーがマルチバイト文字セットを使用している場合は、iocharset を指定して、ローカルパス名を UTF-8 に (または 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 を作成します (ドメイン は必須ではない場合があります)。

    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) を参照してください。

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