Windows/Linux clients can't access to shared folder (samba)

Issues related to applications and software problems
Post Reply
Mtunaca
Posts: 4
Joined: 2012/02/27 15:51:28
Location: Chile

Windows/Linux clients can't access to shared folder (samba)

Post by Mtunaca » 2012/02/27 16:23:28

Hello, i have searched on the forum, but i can't find information of my problem.

I have installed Centos 6.2 (x64) and Samba (3.x), i configured the smb, smbusers and lmhosts. The problem is, that from a Windows/Linux client i can't access to a shared folder, it says (i have Windows in spanish, in english could be:): [b]"Windows hasn't permission to obtain access to \\Server\folder" [/b]. However i can see the folder, but not access to it.

Config files:

[b]smb.conf[/b]

[code]
# ----------------------- Network Related Options -------------------------
workgroup = WORKGROUP
server string = MainServer

netbios name = mainserver

interfaces = lo eth0 192.168.1.5/24
hosts allow = 127. 192.168.1.
client lanman auth = yes
[/code]
[code]# ----------------------- Standalone Server Options ------------------------
security = share
passdb backend = tdbsam
[/code]
[code]
#============================ Share Definitions ==============================
#This is my shared folder
# Carpeta para compartir en ETG
[Compartido]
comment = Archivos publicos
path = /home/etg/Compartido
public = yes
writable = yes
browseable = yes
[/code]


[b]lmhosts[/b]
[code]127.0.0.1 localhost
192.168.1.5 mainserver
[/code]


[b]smbusers[/b]
[code]# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
nobody = guest pcguest smbguest
etg = etg
[/code]


[b]Log:[/b]

[code][2012/02/27 12:36:05.637677, 1] smbd/service.c:1070(make_connection_snum)
__ffff_192.168.1.4 (::ffff:192.168.1.4) connect to service etg initially as user etg (u$
[2012/02/27 12:36:19.380725, 0] lib/util_sock.c:1635(get_peer_name)
Matchname failed on . ::ffff:192.168.1.4
[2012/02/27 12:36:19.529421, 1] smbd/service.c:1070(make_connection_snum)
__ffff_192.168.1.4 (::ffff:192.168.1.4) connect to service Compartido initially as user$
[2012/02/27 12:36:20.651613, 1] smbd/service.c:1251(close_cnum)
__ffff_192.168.1.4 (::ffff:192.168.1.4) closed connection to service etg
[2012/02/27 12:36:22.654611, 1] smbd/notify_inotify.c:421(inotify_watch)
inotify_add_watch returned Permiso denegado
[2012/02/27 12:36:38.645288, 1] smbd/service.c:1251(close_cnum)
__ffff_192.168.1.4 (::ffff:192.168.1.4) closed connection to service Compartido
[2012/02/27 12:41:35.207650, 0] lib/util_sock.c:1635(get_peer_name)
Matchname failed on . ::ffff:192.168.1.4
[2012/02/27 12:41:35.339815, 1] smbd/service.c:1070(make_connection_snum)
__ffff_192.168.1.4 (::ffff:192.168.1.4) connect to service Compartido initially as user$
[2012/02/27 12:41:38.576492, 1] smbd/notify_inotify.c:421(inotify_watch)
inotify_add_watch returned Permiso denegado
[2012/02/27 13:09:57.789484, 1] smbd/notify_inotify.c:421(inotify_watch)
inotify_add_watch returned Permiso denegado
[2012/02/27 13:11:57.420133, 1] smbd/notify_inotify.c:421(inotify_watch)
inotify_add_watch returned Permiso denegado [b]Here says "Access denied"[/b]
[/code]


I have added the user (the same of the session) on the smbpasswd.
I have changed the permissions on the folder to 777 (to try if can access). etc.
I have selinux disabled (this is just a test server).
The firewall has the ports opened.

Mtunaca
Posts: 4
Joined: 2012/02/27 15:51:28
Location: Chile

Re: Windows/Linux clients can't access to shared folder (samba)

Post by Mtunaca » 2012/02/27 18:39:00

Ok, i solved the access to the folder. Now i can read the files, but not write.

nryoung
Posts: 2
Joined: 2012/02/25 06:51:35

Re: Windows/Linux clients can't access to shared folder (samba)

Post by nryoung » 2012/02/27 18:54:59

[quote]
Mtunaca wrote:
Ok, i solved the access to the folder. Now i can read the files, but not write.[/quote]

It would help in troubleshooting if you post what you changed to get access to the folder.

Mtunaca
Posts: 4
Joined: 2012/02/27 15:51:28
Location: Chile

Re: Windows/Linux clients can't access to shared folder (samba)

Post by Mtunaca » 2012/02/27 20:27:25

Only changed the directory, Linux denied me to read on /home/user folder, then i created on /home, now i can access to the folder. However i still haven't permission to write. :-(

Mtunaca
Posts: 4
Joined: 2012/02/27 15:51:28
Location: Chile

Re: Windows/Linux clients can't access to shared folder (samba)

Post by Mtunaca » 2012/02/28 14:07:51

OK, now is solved. THe problem was Selinux... wasn't disabled after all.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Windows/Linux clients can't access to shared folder (samba)

Post by pschaff » 2012/03/01 22:50:06

Disabling SELinux is [b]not[/b] a solution. Putting it in permissive mode ([b]setenforce 0[/b]) and getting the information on how to fix the problem, before returning to Enforcing ([b]setenforce 1[/b]) is.

Some articles to help you along the learning curve:
http://wiki.centos.org/HowTos/SetUpSamba
http://wiki.centos.org/HowTos/SELinux
http://wiki.centos.org/TipsAndTricks/SelinuxBooleans

Temporary SELinux fix:
chcon -R -t samba_share_t /home/etg/Compartido

This label will not survive a relabel. A better solution to make the change permanent, you must tell the SELinux system about the label customization. The semanage command can customize the default file contexts on your machine. restorecon will read the file_context and apply it to the files and directories:

semanage fcontext -a -t samba_share_t ’/home/etg/Compartido(/.*)?’
restorecon -R -v /home/etg/Compartido

Alternative approach - Fix from SELinux denial logs:
cat /var/log/messages | audit2allow -w
cat /var/log/messages | audit2allow -M fix
semodule -v -i fix.pp

If any of the above give "Command not found" then[code]yum install policycoreutils[/code]

Post Reply