I have very weired access denied problem with Samba.
I have a NAS with Samba as a file server installed. Samba works fine as
expected several days ago. I could write, read and delete files on the
share. After copying files from a Win10 client to the server I can only
read the files from the Samba share, but I can not copy new files to the
share nor delete files (ACCESS_DENIED error occurs). Strange thing is:
sometimes all is normal after a reboot so writing, deleting and reading
is fine. But after the next reboot or when restarting Samba, only
reading is possible.
File permissions should be correct (listed below). Even if the file has
permissions 0777 the file can not be deleted. The user that is used to
connect to the Samba server is "photos". If I log into the server, I'm
able to delete the file as user "photos". As attachments I send you the
succeed case (log level 5) and the failing case (log level 10).
* OS: CentOS 7.3
* Samba version: 4.4.4 12.el7_3
* Share is a mounted RAID 1 to /media/data
* SELinux is disabled to identify the problem
Maybe I solved the problem myself. The problem is a toggling hostname.
When the machine boots up it has the hostname "localhost.localdomain".
When Samba starts right away it gets this hostname. But through DHCP the
machine gets another hostname. So it depends when Samba is started:
before or after the DHCP call.
On Sun, 12 Mar 2017 16:02:52 +0100
Bird Developr via samba <[hidden email]> wrote:
> Maybe I solved the problem myself. The problem is a toggling hostname.
> When the machine boots up it has the hostname "localhost.localdomain".
> When Samba starts right away it gets this hostname. But through DHCP
> the machine gets another hostname. So it depends when Samba is
> started: before or after the DHCP call.
> According to this documentation the hostname plays an important role:
> https://www.samba.org/samba/docs/man/Samba-Guide/upgrades.html .
> So I set the "netbios name" property in the smb.cnf and also set a
> fixed hostname in /etc/hostname.
> Hopfefully that will solve this problem.
OK, I use Debian and on a DHCP client, I have the clients short
hostname in /etc/hostname, in /etc/hosts there is this:
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
I do not have 'netbios name' in smb.conf.
I think this is a Centos problem, not a Samba one. It is very easy to
miss where you can set the hostname when installing Centos and the
computers name then gets set to localhost.localdomain