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.
Answer from shodanshok on serverfault.com
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
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › troubleshooting
Samba Write Access Denied Windows 10 - Raspberry Pi Forums
I just ran chmod -R g=rwx /media/hdd4tb/shares/torrents/ and that fixed my issue. Thanks for the help. Hmm, if I physically take that hard drive and connect it to another linux machine instead of using samba shares, how do I keep permissions intact if I'm working with the files?
🌐
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 - This time I plan to use the ext4 partition for Samba. I then studied thagrol's nas.pdf and followed the instructions, mostly section 5. All seemed to go according to plan. Went to my Windows PC, after some back and forth, Win10 found the Pi-Samba and allowed read/write with no problems!
🌐
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 - I have problem with acessing samba shared folders trought windows 10. I got permission error (with the root user too). I created a test director in /media/teszt. I set it for my personal user ch 777. With these rules i can acess the folder. I can write and read it without error.
🌐
Reddit
reddit.com › r/raspberry_pi › help with samba share and windows 10 - "access is denied" but can access home directory.
r/raspberry_pi on Reddit: Help with Samba share and Windows 10 - "Access is denied" but can access home directory.
October 3, 2015 -

SOLVED

Steps in the end

Been breaking my head over setting up samba on my RPi2. I got my Pi last week and I set it up with no issues and then I had to reflash the SD card and start from scratch and I forgot to keep note of the steps and settings(my bad for not taking a backup, I know)

So I am facing an "Access is denied" error when trying to access from "Network" in Windows 10. I have tried with modifying group policy settings too but still the same. This is the samba.conf file :pastebin

As stated in the title, I can access the home directory, create files and folders there but as mentioned in the conf file, the other share usb is just stuck at enter password screen which I enter right every time. It just says "Access is denied."

It is a usb of ext4 format mounted at /mnt/usbd automounted at reboot.

It would be very helpful and would appreciate it if someone could guide me with what I am doing wrong.

Steps

  1. I purged samba and samba-common completely and removed the conf file too.

  2. Install samba and samba-common-bin and samba won't run as there's no conf file so copy smb.conf from usr/share/samba/smb.conf

  3. Now this is my new share file.pastebin Changes made:
    wins support = yes
    encrypt passwords = yes
    added the share in the end as opposed to in the middle of the file from before.

  4. Tested with smbtree and smbclient -L hostname

I sat up and read the samba docs for some time and started on the troubleshooting docs and tried step by step which helped me solve it. link

Thanks to everyone who tried to help me.

🌐
Reddit
reddit.com › r/linuxquestions › samba share "access denied" on windows 10
r/linuxquestions on Reddit: Samba share "Access Denied" on Windows 10
August 29, 2020 -

Beating my head against the wall on this- I'm trying to set up a Samba share on a RPi and for whatever reason when I try to access it from Windows I get "access is denied". When I purposely try a wrong password I get a "username or password is incorrect"- so I know it's recognizing that the password is correct, just denies access for some reason.

My testparm -s output (Trying to access Passport):

# Global parameters
[global]
        log file = /var/log/samba/log.%m
        logging = file
        map to guest = Bad User
        max log size = 1000
        obey pam restrictions = Yes
        pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        server role = standalone server
        unix password sync = Yes
        usershare allow guests = Yes
        idmap config * : backend = tdb
        create mask = 0700
        directory mask = 0700
        valid users = %S


[printers]
        browseable = No
        comment = All Printers
        path = /var/spool/samba
        printable = Yes


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers


[Passport]
        comment = Passport
        guest ok = Yes
        path = /mnt/Passport
        read only = No
🌐
openmediavault
forum.openmediavault.org › index.php
Write to SMB share from Windows 10 denied - Updates/Upgrades - openmediavault
December 21, 2018 - Also check this page - https://superuser.com/question…rd-error-with-samba-share ... Thanks. Setting the "Store DOS attributes" is what I was missing. ... I'm having some luck, but still have issues. In Access Rights - Shared folders, I have selected ACL and given myself read/write access to the folder. When I create a file in it, it gets the owner and group of the user, HC1, created when OMV was installed, not mine. When I denied access to HC1 there I could not write to the folder.
🌐
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
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.
Find elsewhere
Top answer
1 of 2
1

For Fedora 25, I am not familiar with fedora version numbers but I am with RHEL/Centos 7.x If you have selinux enabled by default, you might try as root setenforce 0 to temporarily put selinux into permissive mode until next reboot, see if this allows samba access to work. If so then it's a selinux problem, and in RHEL/Centos there is etc/samba/smb.conf.example which explains the samba related selinux commands needed to allow samba shares to work with selinux set to enforcing.

For your version of fedora, I would work off the /etc/samba/smb.conf.example.

for reference here is my working smb.conf from an older version of samba showing what i believe is the minimum required to get it to work. If you go too restrictive with settings then you can prevent a successful connection so sometimes it's best to not specify which generally means allow for all.

In your [myshare] take out allow hosts and valid users. Once samba working then consider adding restrictive measures like these as necessary.

[global]
#       min protocol = SMB1 needed for winxp
        min protocol = SMB1
#       max protocol SMB2 needed to work with win10, unspecified for this older version of samba is smb1.
        max protocol = SMB2 
        security = user
        passdb backend = tdbsam
#       map to guest = never prevents popup option, bad user allows popup in windows
        map to guest = Bad User

[data]
    path = /data
    read only = No
#   guest ok = no
#   create mask = 660
#   directory mask = 770

with guest ok = no, and map to guest bad user, will allow popup in windows giving anyone a chance to enter correct linux username and pw. map to guest never prevents popup, meaning the username of the windows user has to be the same as a valid local user in linux, per security=user. You likely do not need min/max protocol specified, I do in samba version 3.6. I don't know what verion of samba u have in fedora 25, if it's samba 3.x then try specifying the min/max protocol.

don't forget to do smbpasswd -a <username on your linux system.

2 of 2
0

I have a system that allows WinXP and Win7 to access samba as guests. A few entries that may help are:

[global]
security = user
null passwords = yes
map to guest = Bad Password
guest ok = Yes

I am using wide open shares on a trusted lan.

🌐
OpenWrt Forum
forum.openwrt.org › installing and using openwrt
Samba Share Access Denied on Windows 10 and Android - Installing and Using OpenWrt - OpenWrt Forum
March 15, 2023 - I've been bashing my head against this for HOURS searching every thread on every site I can find, but so far nothing that has worked for other people has worked for me. I am trying to setup up a network share on a USB drive with Samba4 on my router. I followed the instructions on this page https://openwrt.org/docs/guide-user/services/nas/cifs.server, step by step, very carefully, twice.
🌐
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
Whatever username you use must exist as a Unix user. you should also create the same user on all computers that will connect to the share, ideally using the same password everywhere. If you are connecting from a Windows 10 machine and it still does not work, then you may have to turn SMBv1 on, ...
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › networking
SAMBA permission denied from Windows - Linux Mint Forums
Have you created the user 'bpenven' as a Unix and Samba user ? Lets take your 'Jellyfin' share, line by line, ignoring the 'path': force user = bpenven This means that every authenticated user that connects becomes 'bpenven' guest ok = Yes This means that unknown, unauthenticated users can access the share as the user 'nobody' read only = No This means the share is readable and writeable valid users = bpenven This means that the only user that can connect is 'bpenven', so this stops guest access in its tracks, 'nobody' will not be allowed.
Top answer
1 of 5
103

I recommend to create a dedicated user for that share and specify it in force user(see docs).

Create a user (shareuser for example) and set the owner of everything in the share folder to that user:

adduser --system shareuser
chown -R shareuser /path/to/share

Then add force user and permission mask settings in smb.conf:

[myshare]
path = /path/to/share
writeable = yes
browseable = yes
public = yes
create mask = 0644
directory mask = 0755
force user = shareuser

Note that guest ok is a synonym for public.

2 of 5
6

In the share settings in smb.conf, you'll need to specify the names of users and/or groups that are allowed to write to the share, using a write list = ... line.

Example:

[myshare]
...
write list = my_linux_username

Then you'll need to use the smbpasswd command to set up a password to authenticate my_linux_username for Samba:

sudo smbpasswd -a my_linux_username

This step is necessary because the standard system passwords in /etc/shadow are hashed in algorithms that are incompatible with the password hash algorithms used in the SMB protocol. When a client sends a SMB authentication packet, it includes a hashed password. It can only be compared to another password hash that uses the same algorithm.

(Very, very old instructions from the previous millennium may recommend disabling password encryption in Samba, and using certain registry hacks to allow Windows to emit unencrypted passwords to the network. This advice is obsolete: those registry hacks may no longer work in current versions of Windows, and allow anyone who can monitor your network traffic to trivially capture your password.)


There's one more thing you may have to do client-side. When your Windows client system is joined to an Active Directory domain and you're logged in with an AD account, it automatically prefixes all unqualified usernames with the name of the AD domain of the user, i.e. you will be authenticating as AD_DOMAIN\your_username, not just your_username.

If you are logged in with a local account (or your client system is not joined to an AD domain), Windows may automatically prefix the username with the client hostname unless you specify another domain name.

To successfully log in to a stand-alone Samba server from a stand-alone Windows client, you may have to specify your username as SAMBA_SERVER_HOSTNAME\your_username.

Otherwise Samba will see the username as WINDOWS_CLIENT_HOSTNAME\your_username, conclude that it has no way to verify any users belonging to domain named WINDOWS_CLIENT_HOSTNAME, and will reject the login.

(Newer versions of Samba may have a built-in check for this specific situation, and they might allow you access nevertheless. But this is basically how SMB authentication works "under the hood", and if you need to deal with old versions of Samba, it might be useful still.)

🌐
GitHub
github.com › microsoft › WSL › issues › 3937
Samba doesn't work : permission denied when using smbpasswd · Issue #3937 · microsoft/WSL
March 24, 2019 - # The path below should be writable by all users so that their # profile directory may be created the first time they log on ;[profiles] ; comment = Users profiles ; path = /home/samba/profiles ; guest ok = no ; browseable = no ; create mask = 0600 ; directory mask = 0700 [printers] comment = All Printers browseable = no path = /var/spool/samba printable = yes guest ok = no read only = yes create mask = 0700 # Windows clients look for this share name as a source of downloadable # printer drivers [print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = yes
Author   microsoft
🌐
Unraid
forums.unraid.net › home › unraid os support › general support › write permission denied for smb share
Write permission denied for SMB share - General Support - Unraid
August 29, 2021 - I am unable to write to a public SMB share (share is exported and public). I am able to read from the share. I am authenticating as a guest. The output of smbstatus while authenticated is: Samba version 4.11.4 PID Username Group Machine Protocol Version Encryption Signing ------------------------...
🌐
Server Fault
serverfault.com › questions › 1112551 › samba-shared-folder-on-ubuntu-20-04-permission-denied-when-writing-from-windows
samba shared folder on ubuntu 20.04 permission denied when writing from windows 8 machine - Server Fault
October 8, 2022 - I setup a shared samba folder on ubuntu 20.04 It appears on the Windows 8.1 machine on the same subnet but if I try to write to the folder I get a permission denied error ... You could also check if your user has the right to write to those files locally. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... 5 When accessing Samba shares from Windows 10, smbstatus is reporting duplicate nobody:nogroup PID entries
🌐
Ask Ubuntu
askubuntu.com › questions › 783322 › access-denied-creating-a-folder-in-a-samba-share-from-a-windows-client
16.04 - Access Denied creating a folder in a Samba Share from a windows client - Ask Ubuntu
June 6, 2016 - Also have altered the setfacl to give permission for techo2 and techo2 to have rwx access and these list with getfacl. Am trying to connect from windows 7 clients, but there will be some windows 10 clients. Thanks for the opportunity to post a question for this issue. ... After looking through another question here, I found a link on a question someone else had asked which was a good answer, which is listed below: http://www.krizna.com/ubuntu/setup-file-server-ubuntu-14-04-samba/