CIFS を使用して Red Hat Enterprise Linux システムに Windows 共有をマウントする
Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
Issue
- Red Hat Enterprise Linux で Windows 共有をマウントするには
Resolution
- 以下のように、
mountコマンドのcifsオプションを使用すれば、RHEL システムに Windows 共有をマウントできます。
[root@host ~]# mount -t cifs -o username=<share user>,password=<share password> //WIN_PC_IP/<share name> /mnt
- ユーザーが windows ドメインの場合は、以下のようにドメインを定義できます。
[root@host ~]# mount -t cifs -o username=<share user>,password=<share password>,domain=example.com //WIN_PC_IP/<share name> /mnt
- windows 共有は、デフォルトではフルアクセス権 (777) で Linux にマウントされます。デフォルトのアクセス権を変更するには、
dir_modeおよびfile_modeオプションを使用してディレクトリおよびファイルのアクセス権を設定します。
[root@host ~]# mount -t cifs -o username=<share user>,password=<share password>,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
- windows マシンから共有フォルダをマウントする際に以下のエラーが発生した場合は、
mount error(13):Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
windows マシンのフォルダのアクセス権を確認してから、共有フォルダーのマウントを再度試してみてください。
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.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
