I am having problems setting up a Samba server, or to be more exact the problem is that i have set up the server, but it sometimes stops working for several hours and then starts again. It is always accessible from other Linux machines using smbclient, the problem is only present when trying to access it from Windows 7 machines. I have set up 2 servers in our company with the exact same configuration on exactly the same kind of server and one always works, while the other sometimes works and sometimes doesn't, seemingly at random.

The folder i am trying to share is located at /opt/kie and is owned by the user "wildfly". This is my smb.conf:

log level = 2
security = user
map to guest = bad password

#============================ Share Definitions ==============================

path = /opt/kie
available = yes
valid users = wildfly
read only = no
browsable = yes
writable = yes
guest ok = yes
map to guest = Bad User
guest account = wildfly
force user = wildfly

I have also created a Samba user called wildfly. These are the commands that were usually useful for making Samba work:

systemctl disable firewalld
service firewalld stop
chcon -t samba_share_t /opt/kie -R
chown wildfly:wildfly /opt/kie -R
service smb restart
service nmb restart

These disable the firewall that was blocking Windows from connecting to Samba, set up the correct access rights and restart both Samba services. However in this case even running all of these doesn't help.

On the machine itself (and also from the another Linux machine in the company) i can run this command: smbclient //netenab/kie --user=wildfly and the connection gets set up without any problems.

The problem

The problematic server's name is netenab and the working server's name is netenab-test. Even though they both have the exact same configuration, windows can only connect to netenab-test, but not to netenab. Both machines are running "Oracle Linux Server 7.1".

In Windows console these are the results of trying to view the shares:

C:\>net view \\netenab-test
Shared resources at \\netenab-test

Samba 4.2.3

Share name  Type  Used as  Comment

kie         Disk  (UNC)
The command completed successfully.

C:\>net view \\netenab
System error 5 has occurred.

Access is denied.

In the second case it takes exactly 20 seconds for the error message to appear, so this seems to be some kind of timeout. Pinging netenab from the Windows machine works properly, and i can also telnet to port 445 on it.

If i increase the log level to 3, this is the message that appears at this time:

[2016/04/15 07:37:51.289585,  3] ../source3/smbd/server_exit.c:249(exit_server_common)

These are the full level 3 and level 10 logs: http://pastebin.com/WvCJYjH3 http://pastebin.com/vdbeeKa0

The problem is very mysterious exactly because how the share starts and stops working. Yesterday afternoon it randomly started working for a few hours while i was researching the error, but this morning it doesn't work again. And when it works it seems to work from some Windows computers, but not from others on the same network. And the next day it stops working from computers where it worked before and starts working from computers where it didn't work before.

As mentioned in the answer here: Samba: Access trouble from Windows I have verified that my Samba user is correctly set up and that i can connect using smbclient.

Does anybody have an idea about what the problem might be here?


I have solved the problem myself, in the end it was not a Samba problem at all, but a Windows problem.

The solution was to add a batch file that sets the credentials for netenab when Windows boots. The batch file contains:

net use \\netenab\kie /user:wildfly wildfly

And i needed to place it into C:\Users[USER]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

| improve this answer | |
  • very similar error with a guest samba share after windows 10 fall update. Your solution works. – SvennD Dec 5 '17 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.