windowsからsambaにアクセス出来ないときの対処法

Windowsからsambaの共有フォルダにアクセスしようとすると、「アクセス許可がありません」とエラーになってアクセス出来ない場合の対処法です。

まずは、sambaのログをチェック

tail /var/log/samba/log.windows_pc

windows_pc (::ffff:192.168.26.58) connect to service samba_share initially as user nobody (uid=99, gid=99) (pid 12406)
[2012/12/06 17:33:52.939250, 1] smbd/notify_inotify.c:421(inotify_watch)

が出ている場合、多くはSelinuxの設定によりアクセス権限がない場合が多いようですが、それでもアクセス出来ない場合は、フォルダの権限がsambaで、使用出来ない場合があるようです。

sambaで共有しているフォルダの権限をチェック

[root@localhost mnt]# ls -Z /mnt/
drwxrwxrwx. nobody nobody system_u:object_r:file_t:s0 samba_share

って、なっていたら

[root@localhost mnt]# chcon -t samba_share_t /mnt/samba_share -R

ってやると

[root@localhost mnt]# ls -Z /mnt/
drwxrwxrwx. nobody nobody system_u:object_r:samba_share_t:s0 samba_share

ってなってアクセス出来るようになります。

windowsからsambaにアクセス出来ないときの対処法