I read a lot of user questions and blogs about this concern, but nothing fixed my issue.
I have a Linux CENTOS host with Windows 10 guest installed in VirtualBox. On Linux, there's a user named "myuser" which shares a directory (777) and is registred to Samba user database. This user has no password restriction. The smb.conf
looks like this:
[global]
workgroup = WORKSPACE_SHARE
security = user
map to guest = bad user
[public]
path = /home/myuser/public
public = yes
writeable = yes
comment = smb share
printable = no
guest ok = yes
Windows has a local user with the same name ("myuser", no password set), file and printer sharing enabled, Microsoft Client enabled, workgroup set which matches the Samba workgroup and uses a private network.
In explorer I can see the Linux host which, indeed, contains the shared folder ("public"). But when a try to access this shared folder, an error alert appears: You do not have permissions to access…
On the internet I read things like "Windows 10 uses SMBv3 but Samba doesn't yet support it" and how to turn SMBv3 off – but it didn't help.
Even modification of Local Security Policies on Windows didn't do the trick: https://superuser.com/a/916835/408191
How can I fix this weird issue?
Best Answer
Some Linux distributions have a so called SELinux implementation in its kernel. It stands for "Security-Enhanced Linux" and, beside other things, restricts Samba shares. If you want to create a share folder then it's not not enough to specify convenient access permissions and a definition in
samba.conf
. You also need to set the correct "Security Context" of the share folder.Following permission mask and security context should do the trick:
All conditions that are already known from different wikis must also be adhered:
smbpasswd -a youruser
samba.conf
may look like this:samba.conf
(all upper-case parts must be customized for your concerning specific environment):Edit: Note that changes via
chcon
aren't permanent. In order to do permanent security context changes use following command:...and to make it effective: