Discussion:
[Samba] Toggling access denied when writing/deleting
(too old to reply)
Bird Developr via samba
2017-03-09 19:20:01 UTC
Permalink
Hello,

I have very weired access denied problem with Samba.

Problem description:
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).


System information:
* 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


File permissions:
* drwxr-xr-x. 5 root root /media/data
* drwxr-xr-x. 50 photos photos /media/data/photos
* drwxrwxr-x. 4 photos photos /media/data/photos/Jahr 2017
* drwxr-xr-x. 2 photos photos /media/data/photos/Jahr 2017/Bilder 0510
(08.01.2017)
* -rwxrwxrwx. 1 photos photos /media/data/photos/Jahr 2017/Bilder 0510
(08.01.2017)/_DSC3806.NEF

getfacl command for file __DSC3806.NEF:
# file: _DSC3806.NEF
# owner: photos
# group: photos
user::rwx
group::rwx
other::rwx


User/Group information:
* user "photos" has id 1001
* group "photos" has id 1001

smb.conf file:
[global]
workgroup = SAMBA
security = user

passdb backend = tdbsam

printing = cups
printcap name = cups
load printers = no
cups options = raw
log level = 5
encrypt passwords = Yes
server max protocol = SMB3

[photos]
comment = Photos storage
path = /media/data/photos
valid users = photos
writable = Yes
browseable = Yes



Best regards,

Vincent
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Bird Developr via samba
2017-03-12 15:10:02 UTC
Permalink
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.


Best regards
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Rowland Penny via samba
2017-03-12 15:40:02 UTC
Permalink
On Sun, 12 Mar 2017 16:02:52 +0100
Post by Bird Developr via samba
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.
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:

127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

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

Rowland
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Loading...