After hours of searching, I discovered that the share name and the share directory cannot be the same (and it's not case-sensitive, either). See this post on serverfault.

So, if I change my share name in smb.conf from:

[Music]

to

[Tunes]

I can both read and write to the share. No other changes to my smb.conf were necessary, and no need to chmod 0777.

Answer from the_meter413 on askubuntu.com
Discussions

Samba permissions mess - can't write anything (from Windows)
you install ssh? enable it? More on reddit.com
🌐 r/linux4noobs
3
3
March 3, 2022
networking - Samba share on Debian: Can see files from windows but can't write to them - Unix & Linux Stack Exchange
I'm trying to set up a samba share to a computer that only I will have access to. I need full access to this computer from my windows machine. I am the only person using either machine, and I need ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
permissions - Samba (Cannot Write) issue - Stack Overflow
I have setup Samba between two linux boxes (Ubuntu Desktop 12.10 and Ubuntu Server 12.04). For some reason I cannot write to my samba share. To me it looks like I have the correct permissions. B... More on stackoverflow.com
🌐 stackoverflow.com
linux - Samba access is denied in windows - Unix & Linux Stack Exchange
I want to access linux (fedora 25 in virtual box), there is two issues: Configure with anonymous access, but windows still asks account and password to access linux by samba. Configure with account More on unix.stackexchange.com
🌐 unix.stackexchange.com
🌐
Reddit
reddit.com › r/linux4noobs › samba permissions mess - can't write anything (from windows)
r/linux4noobs on Reddit: Samba permissions mess - can't write anything (from Windows)
March 3, 2022 -

Hello,

I have a game server running on my machine, and I often move files and folders around.

So I decided to use samba (version 4.7.6-Ubuntu) to create a shared folder (which contains the game server) - and I can't write anything.

The folder is located at /home/locale/Documents.

locale is the username of the account I use to log physically on my machine, and is pretty much the "admin" account. (Note : they don't have root privileges, I'm not that dumb)

To connect to that folder, I use another account, named John. (The username of my Windows account).

I can connect to the share from Windows without any trouble, using the credentials from John (inputing the Unix password) ; but I cannot write anything.

This is what I have in my smb.conf for the folder :

[gameserver]
   path = /home/locale/Documents/
   valid users = John
   browsable = yes
   read only = no
   writeable = yes
   available = yes
   create mask = 0775
   force user = John

I've seen plenty of people on the internet using 644 or 755 as a create mask - I don't want that. The directories set in locale/Documents are all set at 775, and I don't want to change that.

drwxrwxr-x  5 locale locale 4096 mars   3 09:19 .
drwxr-xr-x 19 locale locale 4096 mars   3 09:27 ..
drwxrwxr-x 19 locale locale 4096 mars   1 23:53 gameserver

John is of course part of the locale group. So I should not be a problem to write in the folder right ? After all, it works like that for my FTP.

What I should do ? I am really forced to go full on 777 on my folder in order to make this thing work ?

Thanks.

🌐
TechRepublic
techrepublic.com › home › open source
How to Connect Windows to Linux Samba Shares Easily
December 6, 2024 - When Windows 10 was released, it seemingly broke the ability to easily connect to Linux Samba shares. It appeared one could not write to a Linux share from Windows 10. Considering how many businesses rely on Samba to share folders, this was a bad move on Microsoft’s part.
Find elsewhere
🌐
Stack Exchange
unix.stackexchange.com › questions › 441113 › samba-share-on-debian-can-see-files-from-windows-but-cant-write-to-them
networking - Samba share on Debian: Can see files from windows but can't write to them - Unix & Linux Stack Exchange
[IPC$] path = /tmp [lookie] comment = open share on %h path = /samba/share/lookie # all files copied to this share have full r/w to all create mask = 0777 delete readonly = yes ## This user must have read/write to the share directory ## May require R/W for the full path up to the share. Check. force user = expert read only = No browseable = yes ... Samba version is 4.5.12-Debian. Installed by sudo apt-get install samba, using Windows 10, not sure if I can see the windows install from the linux virtual machine, but the windows install can see the linux virtual machine files all right, just can't edit them.
🌐
Doug Rathbone
dougrathbone.com › blog › 2018 › 04 › 02 › fixing-broken-samba-sharing-after-installing-the-latest-version-of-windows-10
Fixing broken Samba File Share access for Linux hosts after installing the latest version of Windows 10 - Doug Rathbone
With this little fact to go on, I had the idea that Windows 10 may be blocking Samba clients from negotiating at lower levels of the SMB protocol. SMB 3.1.1 was released with Windows 10 and Windows Server 2016, adding improved encryption.
Top answer
1 of 1
1

From your comment:

I forgot to mention that the drive in /media/USBHDD/shares is formatted in NTFS, to be readable on windows. That makes it unable to be changed using chown and chmod, which are both solutions that I've already tried.

I guess you're using ntfs-3g. In this case you should research the following mount options of it: uid,gid,dmask,fmask. First thing you should do is passing uid=MYUSERNAME to whatever mechanism mounts the drive. This will make the filesystem appear as if everything in it belonged to MYUSERNAME.

If you were mounting via fstab, the proper line would look similar to the one in this question (but read my answer there). The path /media/… suggests the drive might be mounted by some sort of automounter; if so, then you should configure its options.

Some parts of my original answer (below) apply to filesystems that support UNIX permissions. With NTFS, instead of chown you should just pass proper uid and gid while mounting.


Original answer:

Your share and objects under it are owned by root and only the owner has write permissions. I'm talking about UNIX permissions in ls -l output, this itself has nothing to do with Samba.

Then Samba forces any valid user (valid users = backups MYUSERNAME root; these are Samba users, not necessarily UNIX users) to be MYUSERNAME (force user = MYUSERNAME) in context of UNIX permissions. This user has no write access.

Possible solutions:

  • let MYUSERNAME own everything in the share:

    sudo chown -R MYUSERNAME: /media/USBHDD/share
    
  • give every user write access to everything in the share:

    sudo chmod -R +w /media/USBHDD/share
    
  • a combination of above, with reduced scope maybe; or a solution that uses group access; now you know what the issue is, so ask yourself what permissions to what asset you want to give to whom.

  • force user = root (if possible), but this would be stupid.

Some of these solutions will work better with different create mask and directory mask in Samba configuration. Research and understand their meaning.

🌐
Windows 10 Forums
tenforums.com › network-sharing › 31136-samba-shares-dont-show-up-windows-10-network.html
Samba Shares don't show up in Windows 10 Network Solved - Windows 10 Forums
Computer Type: Laptop System Manufacturer/Model Number: Lenovo Thinkpad T510 OS: Windows 10 CPU: i5-M520 Antivirus: Comodo Internet Security ... What version of Linux are you using and what version of Samba? Try using system-config-samba if running a Ubuntu based distro.
🌐
Linus Tech Tips
linustechtips.com › computer hardware › servers, nas, and home lab
Samba server can't write - Servers, NAS, and Home Lab - Linus Tech Tips
September 6, 2020 - Hi guys So I set up a samba server on my "new" computer just like I did multiple times before (I change hardware quite often), but now whatever I do I can't write to the samba shares from Windows 10 The samba server runs on a pc running Linux Mint 20 64 bit This exact config has worked for me on ...
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
Top answer
1 of 2
2

The problem is not the Samba share but a new security setting under Windows 10. They specifically made it so that you cannot bypass this behaviour from the Samba side. They explain why under the section Cause.

Symptoms

In Windows 10, Windows Server 2019, or Windows Server 2016, the SMB2 client no longer allows the following actions:

  • Guest account access to a remote server.
  • Fall back to the Guest account after invalid credentials are provided.

SMBv2 has the following behavior in these versions of Windows:

  • Windows 10 Enterprise and Windows 10 Education no longer allow a user to connect to a remote share by using guest credentials by default, even if the remote server requests guest credentials.
  • Windows Server 2016 Datacenter and Standard editions no longer allow a user to connect to a remote share by using guest credentials by default, even if the remote server requests guest credentials.
  • Windows 10 Home and Professional editions are unchanged from their previous default behavior.

If you try to connect to devices that request credentials of a guest instead of appropriate authenticated principals, you may receive the following error message:

You can't access this shared folder because your organization's security policies block unauthenticated guest access. These policies help protect your PC from unsafe or malicious devices on the network.

and

Cause

This change in default behavior is by design and is recommended by Microsoft for security.

A malicious computer that impersonates a legitimate file server could allow users to connect as guests without their knowledge. Microsoft recommends that you do not change this default setting. If a remote device is configured to use guest credentials, an administrator should disable guest access to that remote device and configure correct authentication and authorization.

Windows and Windows Server have not enabled guest access or allowed remote users to connect as guest or anonymous users since Windows 2000. Only third-party remote devices might require guest access by default. Microsoft-provided operating systems do not.

and

Resolution

If you want to enable insecure guest access, you can configure the following Group Policy settings:

  • Open the Local Group Policy Editor (gpedit.msc).
  • In the console tree, select Computer Configuration > Administrative Templates > Network > Lanman Workstation.
  • For the setting, right-click Enable insecure guest logons and select Edit.
  • Select Enabled and select OK.

Source

https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/guest-access-in-smb2-is-disabled-by-default

2 of 2
1

If you assign the "Everyone" role with Read or Read/Write it will allow you to connect without authenticating. Also remember the Share permissions don't override the NTFS permissions for files, so assign Everyone to Read/Write on the folders too (not just the share permissions).

Here's a tutorial https://websiteforstudents.com/create-shares-everyone-full-access-windows-10-server/

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.

Top answer
1 of 1
5

Looks like you created a folder miguel in the media and you have taken ownership of it. Instead, let's create a group, add users to that group, and set the permissions.

sudo groupadd -g 10000 [samba_group]
sudo adduser migeul [samba_group]
sudo chown root:[samba_group] -R /media/migeul
sudo chgrp [samba_group] /media/migeul
sudo chmod 775 -R /media/migeul

This will create a group and attach it to the folder to be shared. You add the users to that group for access. Set the permissions to 775 which gives the owner and the group read-write-execute access while others only read. Set's it recursively.

Verify that you have total access to the folder. With samba, setting the permissions are a little bit different than file permissions with a ubuntu user. What I mean is that verify the permissions after you take ownership because they could result in a samba error later on down the road. Where nobody can access the drive.

Create a samba account that matches your Linux username precisely.

sudo smbpasswd -a miguel
sudo smbpasswd -e migeul

That will prompt you to create a password for the username miguel. Please note that this is only for SMB shares not for the user in the Operating System.

Afterward, open up the samba config and when sharing the drive make sure you type in writable = yes, browsable = yes, read only = no and add your group to it as well. Also, verify the location you are sharing from. Use the place that it is mounted to.

[migeul]
comment = Migeuls folder
​path = /media/migeul
​browsable = yes
​writable = yes
​guest ok = no
​read only = no
​valid users = @[samba_group]

After you reconfig the /etc/samba/smb.conf file, reload it.

sudo smbd reload

These pages go more in-depth with setting up samba shares.

https://help.ubuntu.com/community/Samba/SambaServerGuide https://www.techrepublic.com/article/how-to-set-up-samba-shares-for-groups/

You may also need to set your umask as well. To do that open up /etc/profile using sudo nano /etc/profile and at the bottom type in umask 002. Use Control+O to save and Control+X to exit. Best to reboot the server using sudo reboot and the new mask permissions will take place. That setting re-asserts the same permissions for the users.

🌐
openSUSE Forums
forums.opensuse.org › english › network/internet
Samba, after update no access Win10 - Network/Internet - openSUSE Forums
July 23, 2023 - I updated my previous Samba version to 4.17.7 and now I have no more access to shared folders from Windows 10. Another Win10 PC Win 7 and even 2000 still works. So, I assume SMB itself seems to be fine and communicates with Win10 in general. I stuck with “Enter network credentials” and ...