Let's take just the first share as an example - and here I'm correcting the read-only = yes line:

[Fr-data]
path = /free/fr/data
read only = yes
valid users = @global
write list = borhacker
force create mode = 0775
force directory mode = 0775
create mask = 0775
directory mask = 0775

The only user that will gain access to the folder being shared is borhacker. Not becase of the share definition in smb.conf but becase the parent folder only allows that user access. In fact borhacker is the only user that can access any of these shares for the same reason.

This represents the Linux permissions on /free/fr:

drwxrwx--- 15 borhacker borhacker 15 Dec 19 12:39 .

You need to allow users other than borhacker the ability to traverse the /free/fr folder:

sudo chmod 775 /free/fr

A samba share definition cannot override the Linux permissions of the folder being shared or the Linux permissions of the path to that folder

Answer from Morbius1 on askubuntu.com
🌐
Fedora Discussion
discussion.fedoraproject.org › ask fedora
Unable to connect to my SMB share - permission denied - Fedora Discussion
September 3, 2022 - I set up a samba server on my laptop for family members. The setup is like this: Added a separate user for share called shareuser with uid=250 Added the user to the smb database, password set up: sudo smbpasswd -a shareuser Created a group for the smb share and added the user to it: groups shareuser shareuser : shareuser smbgroup1 Set the SELinux context properly, changed group ownership to smbgroup1 (recursive): drwxrwx---. 6 my...
Discussions

samba - permission denied when share in another users home directory - Unix & Linux Stack Exchange
I have the two users equah and hoster on my machine. I created a samba share test1 in /home/equah, which is accessible by user equah without any problem. I also created the share test2 in /smbtes... More on unix.stackexchange.com
🌐 unix.stackexchange.com
September 8, 2018
Samba doesn't work : permission denied when using smbpasswd
Your Windows build number: (Type ver at a Windows Command Prompt) Microsoft Windows [Version 10.0.17763.379] What you're doing and what's happening: (Copy&paste the full set of specific command-lin... More on github.com
🌐 github.com
10
March 24, 2019
SAMBA Permissions not matching linux permissions?
Are you trying to move files around in a subfolder, or the root of the share? If just the root look at the owning group / group permissions on the share. If sub folders check the other user/group owners. Maybe this will help? https://wiki.samba.org/index.php/Setting_up_a_Share_Using_POSIX_ACLs Also worth saying that to control access to the share, you should use the "valid users" option in smb.conf on the share (this option can also take groups using @group). Do not use the owner / group of the samba directory to control this. In some complex scenarios, you can also setup default ACLs to specifically allow access to a certain group. More on reddit.com
🌐 r/homelab
9
0
August 6, 2024
Samba: Permission Denied
Honestly the issue could be quite a number of things. Samba can fail for any number of reasons, without the logs we don't know why its failing, dmesg and samba logging needs to be enabled (please if you post it use a service like pastebin and link it). Second, I can tell you right now chmodding octal permissions on an ntfs partition isn't going to work.. NTFS/Windows uses Discretionary Access Control (DACL) and the two are incompatible. chmod won't do anything. Also NTFS is case insensitive, where as nix is case sensitive which is another way things can fail. Also even once you correct the initial permission errors it will be extremely slow because its using the ntfs-3g driver which is non-native and makes a lot of context switches. You should setup the host system as a regular linux partition possibly with the windows_naming option, and then configure the Samba share, this greatly reduces the scope of where things can go wrong. It also looks like you are using SELinux in enforcing mode, this can cause issues as well; you might want to try this in permissive mode until you can rule out SeLinux. There are also commonly issues where the accounts being used may not mapped to the right ldap fields (samaccount names). If you are using samba and authenticating with ldap this can be yet another issue. More on reddit.com
🌐 r/linuxquestions
4
1
December 5, 2019
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
Samba fileshare Permission Denied help asked (seems to be a common confusion) [Solved] - Raspberry Pi Forums
June 6, 2023 - I'm not surprised you're having problems. What file system has that USB device been formatted with? If it's a windows one (FAT, exFAT, NTFS, etc) chmod and chown do nothing as those don't support them. Are you using guest access or logging in to teh Samba server?
🌐
GitHub
github.com › microsoft › WSL › issues › 3937
Samba doesn't work : permission denied when using smbpasswd · Issue #3937 · microsoft/WSL
March 24, 2019 - If you want to # create files with group=rw permissions, set next parameter to 0775. create mask = 0700 # Directory creation mask is set to 0700 for security reasons. If you want to # create dirs. with group=rw permissions, set next parameter to 0775. directory mask = 0700 # By default, \\server\username shares can be connected to by anyone # with access to the samba server.
Author   microsoft
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › samba-permission-denied-4175633853
[SOLVED] Samba - Permission Denied
July 12, 2018 - Hello I am relatively new to Linux and am struggling to get a SMB share up and running between two Linux boxes. I have two Linux boxes (A and B), both
🌐
Reddit
reddit.com › r/homelab › samba permissions not matching linux permissions?
r/homelab on Reddit: SAMBA Permissions not matching linux permissions?
August 6, 2024 -

Logged into the server with a bash prompt as my domain user, I'm able to move around the files as expected. It's only when accessing it over samba, both windows and another linux vm, that I'm getting permission denied moving the files.

I think it's samba specifically, since I'm also mounting the fs from a linux vm and it's giving me the same behaviour.

The only workaround we have right now is to add our usergroup as admin in the smb.conf to get permissions.

Any ideas?

(Sambas support is only through a broken mailing list atm, so thought i'd ask here. ^^)

Thanks!

Find elsewhere
Top answer
1 of 7
14

To access the samba share, please pay attention to:

  1. You had to create a system user with the same username. In this case, please issue the following command: useradd -s /sbin/nologin benjamin
  2. If you are using a SELINUX-enabled system (eg: CentOS), try to temporarily disable it issuing setenforce 0

EDIT: as the problem persists, try the following:

  1. maybe your Windows host is prepending your username with the wrong domain name. From the Windows machine, try to login using localhost\benjamin as the username
  2. issue pdbedit -L and check if user benjamin is listed. If so, set a trivial password (you can change it later) using smbpasswd benjamin
  3. if user benjamin is not listed, try to recreate it issuing smbpasswd -a benjamin
  4. if it does not work, delete the passwd file (it is named passwd.tdb; for reference, in a CentOS 6.x system it is found under /var/lib/samba/private/). Then, recreate your user issuing smbpasswd -a benjamin
  5. if it still not working, try to use the root account issuing smbpasswd -a root and check if you can login using the root user. Note: this is only a try. After having done with it, you must delete root's entry issuing smbpasswd -x root
  6. Your last resort is to increase the verbosity of logging and see if you can find clues there. For authentication attempts, edit or add the following line on your smb.conf log level = 2 winbind:5, check the logs with something like tail -f /var/log/samba/log* and try to login.
2 of 7
12

It is possible you need to add the user in question to your smb service in linux

sudo smbpasswd -a myuser
🌐
Microsoft Learn
learn.microsoft.com › en-us › troubleshoot › windows-client › networking › access-denied-access-smb-file-share
Access Denied when you access Server Message Block (SMB) file share - Windows Client | Microsoft Learn
February 12, 2026 - This issue occurs because the target folder on the SMB share is missing the SYNCHRONIZE access control entries. To resolve this issue, use the ICACLS utility to set the desired permissions that contain the Synchronize bit.
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › projects › networking and servers
samba server gives me a permission denied error when connecting - Raspberry Pi Forums
[global] log file = /var/log/s... /home/shares/public/disk1 read only = No create mask = 0660 directory mask = 0770 You then need to create users with 'smbpasswd -a username' , you need to do this as root (or using sudo), you will be prompted for a password (twice...
🌐
Reddit
reddit.com › r/linuxquestions › samba: permission denied
r/linuxquestions on Reddit: Samba: Permission Denied
December 5, 2019 -

I can't fedora 31's shares from Windows & another fedora box as it keeps returning with "permission denied" from both the windows & linux box. I have tried changing the permissions of the share drive and changing the smb config file. My goal is mount hard drives in the /mnt/ directory and share them to the network, but right now, I am only testing a normal directory outside of the mounted hard drives. I know I am missing something extremely basic with creating a simple samba share, but for the life of me, I can't figure it out. Any advice would be greatly appreciated. Thank you!

    error message from Linux
sudo mount -t cifs -o username=lowao //ip.address/work /mnt/work
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

    error message from windows
Permission not granted or something like that

    ls -ld /mnt/drive
drwxrwxrwx. 2 lowao lowao 4096 Nov 22 18:52 /mnt/drive/

    /etc/samaba/smb.conf
[drive]
comment = Samba
path = /mnt/drive
writeable = yes
browseable = yes
create mask = 0777
directory mask = 0777
guest ok = no
public = no
share modes = yes
valid users = %S

smbd logs || nmbd logs

smbclient -L ip.address
Sharename       Type      Comment
---------       ----      -------
work           Disk      Samba
SMB1 disabled -- no workgroup available

    Samba setup
systemctl enable smb nmb
firewall-cmd --add-service=samba --permanent
firewall-cmd --reload
setsebool -P samba_enable_home_dirs on
useradd -m lowao
pdbedit -a lowao
chmod 0777 /mnt/work
chcon -R -t samba_share/_t /mnt/work

    /etc/fstab
# Windows work
UUID=2460DCC960DCA33A /mnt/work      ntfs    permissions,locale=en_US.utf8 0 2
[Mounting nfts hard drives in /mnt/. These are the partitions I would like to mount and share at some point.]

Solution: Something within the original smb.conf screwed with permissions. Wipe it out and try the following. [global] unix charset = UTF-8 workgroup = WORKGROUP security = user hosts allow = 127. 10.0.0.

[Share01]
     path = /home/share01
     writable = yes
     guest ok = no
     valid users = @smbgroup01
     force create mode = 777
     force directory mode = 777
     inherit permissions = yes

https://www.server-world.info/en/note?os=Fedora_31&p=samba&f=2

🌐
Linux.org
linux.org › home › forums › server linux › general server
SAMBA permission error. Even the sudoers can't acess the directorys. | Linux.org
July 29, 2021 - Contact the administrator of this server to find out if you have access permissions. Not authorized the same user with the same username make more connection with the server. Please cut(?) your earlier connections.
🌐
Reddit
reddit.com › r/linuxquestions › samba not working on brand new ubuntu install after following the ubuntu tutorials guide: permission denied
r/linuxquestions on Reddit: Samba not working on brand new Ubuntu install after following the Ubuntu tutorials guide: Permission Denied
October 19, 2024 -

Hey! Trying to get Samba working on a bare metal, stock Ubuntu 24.04 machine. I'm able to connect to it from my Windows machine and read files, but if I try to write to it, it returns "Permission Denied". All the solutions I've found online involved problems with VM's or some other complicated setup, but this is as simple as it gets and I still can't get it up (user has been replaced, as it contains my full name)

[backups]
   comment = primary file storage
   path = /home/user/Files
   read only = no
   browsable = yes
Top answer
1 of 1
1

"The hosts allow or allow hosts parameter is one of the key advantages of Samba. It allows access control of shares on the ip-address level. To allow only specific hosts to access a share, list the hosts, separated by comma's. Allowing entire subnets is done by ending the range with a dot."

Samba doesn't allow access control with this option on layer 2, only layer 3.

If you want to white list mac addresses you'll have to find another option to prevent network traffic from reaching the service.

Or if you reallllllly want to take some time doing this, you might see if its possible to modify the code and recompile.

I also would check if samba still has the big security vulnerability advertised years ago.

The additional tagging or qualifying that was added last time will be left out, but while showering it occurred to me that I forgot some things.

I apologize for this.

Before the rest is touched on lets analyze the response I gave and your setup:

  1. If your network setup is not tightly controlling ip leasing and network membership, IP access control will not work.

  2. If your samba server is not on the same network segment as the client machines, MAC white listing will not work.

  3. If your not authenticating to the server as well, neither of these solutions will work.

  4. MAC addresses can be spoofed. Its easier these days. If someone can see what the hardware IDs of your devices, by say sniffing the airways in the case of a wifi lan, once they get the key to connect to your network, or even in the case of a wired one where they can plug in somehow, this will not prevent anyone determined enough from getting into your server.

Now lets consider application.

If you're storing something vital, REALLLLLY heed what I'm saying. If you're just sharing movies or video files, not a big deal.

If you're storing executables and people will be running them, restrict write access or you're gonna have some trouble potentially and make sure these executables come from trusted sources and are not altered.

In general, SMB cannot be hardened if the network setup sucks. If I can just plug my computer into the wall and set a static ip address, or mod my MAC address and the dhcpd assigns a specific IP address, instant access.

Also if the password hashing isn't good, or a challenge isn't being sent and the password is even being even being sent in two-way encrypted form across the network, it is potentially possible to access the server.

Also. Don't trust ANY operating system you have not at the very least built yourself and then do not trust it completely. Don't trust any operating system who's code has not been hardened by people you trust or yourself, and then never completely trust an OS that people you trust have modded, because they may not be trustworthy.

But like I said, consider application and making sure people have to authenticate somehow to some network service to be granted access, and you're probably fine.

About the only way to protect data is to keep it in an isolated physically read only form and keep it in your possession or locked up these days. These are the times we live in where bad people did bad things, and tried to do even worse bad things and create our current mess and now everyone is suffering for their idiocy and the original offenders are laughing in hades, in between their pitchfork enema.

Top answer
1 of 1
1

RHEL 7 has SELinux enabled by default, and it will restrict Samba's access to the filesystem. When you create your own Samba share in a custom path like /samba/docs, you must apply suitable SELinux labeling to that path.

If you need the directories accessible by Samba and other services, you should use SELinux context type label public_content_rw_t and set the smbd_anon_write SELinux boolean to allow Samba write access to files and directories in public_content_rw_t contexts with full control of file ownerships:

setsebool -P smbd_anon_write=1
semanage fcontext -a -t public_content_rw_t "/samba/docs(/.*)?"
restorecon -Rv /samba/docs

If you don't plan on accessing /samba/docs through any other service (like httpd or ftpd), you can use samba_share_t context instead, and then you don't need the boolean setting:

semanage fcontext -a -t samba_share_t "/samba/docs(/.*)?"
restorecon -Rv /samba/docs

The semanage fcontext -a... command will add the regular expression that defines the new labeling persistently into SELinux configuration, and restorecon will apply the new labeling to the actual filesystem. You could also use chcon to change SELinux context labels, but then your changes would be lost whenever restorecon was executed (e.g. after restoring a backup). Storing the labeling information into SELinux configuration first ensures it can be restored even if your backup methods are not specifically SELinux aware - as long as the SELinux configuration under /etc is also backed up.

🌐
Manjaro Linux
forum.manjaro.org › support › network
Can't access my Manjaro samba server with a "permission denied" error - Network - Manjaro Linux Forum
August 29, 2022 - Hi, recently I try to start a samba server on my Manjaro linux server. I used the default smb.conf setting and add a share which “guest ok =yes”. But when I access this samba share from my another windows/linux. I get a “permission denied” error. My share path is “/mnt/sda 1” which is a NTFS drive to store my data, its owner and group is ‘root’ and permission is ‘777’. The trick thing is when I change the path to ‘/tmp’. The samba share can be accessed but other path is not (e.g.my home path) ...