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 share won't let me write to it
What are the posix permissions on the folder in question? Also, what does the mount line in fstab look like? Or, does mount show your USB drive mount as writeable? More on reddit.com
🌐 r/linuxquestions
4
1
January 24, 2024
Samba share with "force user" is still not writable unless files have 777 permissions - Unix & Linux Stack Exchange
It does not appear to require world write permissions though, so as a workaround you should be able to get away with 660/770 permissions rather than 777. This shouldn't reduce security; it's just annoying to move files into it outside of samba since you need to make them group-writeable. ... sudo chown -R myuser:myuser /home/myuser/share ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
July 23, 2020
How to create a Samba share that is writable from Windows without 777 permissions? - Unix & Linux Stack Exchange
I have a path on a Linux machine (Debian 8) which I want to share with Samba 4 to Windows computers (Win7 and 8 in a domain). In my smb.conf I did the following: [myshare] path = /path/to/share writeable = yes browseable = yes guest ok = yes public = yes More on unix.stackexchange.com
🌐 unix.stackexchange.com
May 29, 2015
Can't write to samba share on Windows 11 despite changing the samba config
Creating a bug report/issue Required Information DietPi version | G_DIETPI_VERSION_CORE=8 G_DIETPI_VERSION_SUB=18 G_DIETPI_VERSION_RC=2 G_GITBRANCH=‘master’ G_GITOWNER=‘MichaIng’ Distro version | bullseye 0 Kernel version | Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 ... More on dietpi.com
🌐 dietpi.com
12
0
June 8, 2023
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › projects › networking and servers
[SOLVED]SAMBA: Can read but can't write to shared drive - Raspberry Pi Forums
# 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
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-networking-3 › can't-write-to-samba-share-4175706103
[SOLVED] Can't write to samba share
I have an OpenMediaVault server with Samba shares. I can mount them remotely but I can't write to them. I've wrestled with this problem quite a bit in
🌐
Reddit
reddit.com › r/linuxquestions › samba share won't let me write to it
r/linuxquestions on Reddit: Samba share won't let me write to it
January 24, 2024 -

Basically I have 4 hard drives that I have mounted in a USB dock that's connected to my Proxmox box and passed through to Ubuntu server. For some reason when I mounted the drive, I can see it but it refuses to let me write to it.

I'm open to other ideas if there's something better. Not looking to use TrueNAS or anything else like that due to the fact that it cannot see all 4 of the drives from that stack. Ideally I'd stick with Ubuntu server. I have considered SFTP, but was hoping to get samba shares up for simplicity so my SO can use it without frustration.

Here's what I have setup so far after reading a handful of different stack overflow suggestions, none of them worked.

🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › troubleshooting
Cannot get write access on a samba shared drive - Raspberry Pi Forums
November 6, 2023 - "fmask=0022,dmask=0022" mean the mounted partition will only be writeable by the mounting user. And when using fstab that's root. You can check with ls -ld /mnt/Music Refer to my fstab guide for how to fix it (and to my posts above). I'm not going to tell you (again) what the correct incantation is. ... testparm -s Load smb config files from /etc/samba/smb.conf Loaded services file OK.
Top answer
1 of 3
11

I think I'm encountering the same problem you have. For some reason force user seems to require group write permissions. It does not appear to require world write permissions though, so as a workaround you should be able to get away with 660/770 permissions rather than 777. This shouldn't reduce security; it's just annoying to move files into it outside of samba since you need to make them group-writeable.

Put this in your smb.conf under [Stuff]:

force user = myuser
create mask = 0660
directory mask = 0770

Then run this on your share folder:

sudo chown -R myuser:myuser /home/myuser/share
sudo chmod -R 0660 /home/myuser/share
sudo chmod -R ug+X /home/myuser/share

Then restart smbd. The above will set all files to 660 and all directories to 770, for currently existing files and for files newly created through samba. Note that you don't need force group; by default it matches the primary group of force user. Also note that I'm denying world permissions entirely here. You could probably use 0664, 0775 and ugw+X instead if you want them world-readable.

Unfortunately I haven't been able to make it work without group write permissions. I suspect it's a bug in samba. The recent samba bug #14617 prevented deleting files via force user. It's possible this is another related bug but I don't know enough about it to report it. If you figure out how to get it working with 0644/0755 please let me know!

2 of 3
2

OK, have you created users with 'smbpasswd -a username' (needs to be run as root) ? If you haven't, then your guest account 'myuser' will not work. This means that no one will be able to access your share. Authentication (based on your smb.conf) works like this: A user connects to Samba and if the user is known and supplies the correct password, they are allowed access to your share, but anything they save will be saved as if belonging to 'myuser', but they will be able to read and write files. If they are a known user, but supply a wrong password, then the connection is silently dropped. Because you have 'map to guest = bad user' in global and 'guest ok = yes' in the share, an unknown user that connects to Samba will be mapped to the guest account 'myuser' before it gets anywhere near the share and as they are now a known user, they will be allowed access to the share. As for the smb.conf being too short, well, yours could be even shorter. You do not need the 'force group' line, the 'force user' will do that for you, also as 'myuser' has write permissions by default, you do not need the 'write list' line. Finally, you never need to set 'browseable = yes' anywhere, it is a default setting.

🌐
Arch Linux Forums
bbs.archlinux.org › viewtopic.php
[SOLVED] Can't write to Samba share on client without chown / Newbie Corner / Arch Linux Forums
Although not relevant to the topic, I have always used these two options, because if you have more than one valid user, you can't write without these options. ... https://wiki.archlinux.org/title/Samba#Manual_mounting Check the actual "mount" parameters and see the blue note in the above paragraph.
Find elsewhere
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.)

🌐
DietPi
dietpi.com › troubleshooting
Can't write to samba share on Windows 11 despite changing the samba config - Troubleshooting - DietPi Community Forum
June 8, 2023 - Creating a bug report/issue Required Information DietPi version | G_DIETPI_VERSION_CORE=8 G_DIETPI_VERSION_SUB=18 G_DIETPI_VERSION_RC=2 G_GITBRANCH=‘master’ G_GITOWNER=‘MichaIng’ Distro version | bullseye 0 Kernel v…
🌐
Stack Overflow
stackoverflow.com › questions › 44896650 › samba-share-not-writable-linux
centos - Samba Share Not Writable (Linux) - Stack Overflow
I then edited my Samba config and added the following: [Storage] valid users = bdawson,@bdawson path = /home/bdawson/Storage write list = bdawson,@bdawson · /home/bdawson was chown -R'd to be owned by bdawson:bdawson. File permissions are set to 0755 for both /home/bdawson and /home/bdawson/Storage. At this point, I am not sure what I'm doing wrong that is preventing me from being able to write.
🌐
Reddit
reddit.com › r/emudeck › emudeck installer says my samba share is not writeable (see post for details).
r/EmuDeck on Reddit: Emudeck installer says my Samba Share is not writeable (see post for details).
January 12, 2023 - I just ended up swallowing my pride and making a symlink to each roms dir on my server and that works for any emulator that doesn't have a symlink in the ROMS dir (psvita is the only one I've run into so far, so not too bad.) More replies ... So I've been working through this setup for a while and I'm a bit stumped at the moment with what to do/where to go. It took me a little while to get a samba share working to play nice, but for the sake of brevity, I ended up just setting up a docker container using dperson/samba.
🌐
Stack Exchange
unix.stackexchange.com › questions › 701039 › cant-make-samba-share-writable
debian - Can't make samba share writable - Unix & Linux Stack Exchange
May 1, 2022 - This awnser solves the problem in case you can mount your share properly with an user/passwd pair and you are able to read the content of the share from a remote client, but you can't write into the share. Of course you need a section in your /etc/samba/smb.conf like this: [BobsVolume] comment = BobsVolume path = /mnt/BobsVolume create mask = 0600 directory mask = 0700 read only=No guest ok=No valid users = bob · The most important parameter is read only=no and valid user. writeable=yes is a synonym.
🌐
Super User
superuser.com › questions › 1480114 › samba-share-is-not-writable-from-windows
centos - Samba Share is Not Writable From Windows - Super User
September 7, 2019 - [SHARENAME] comment = Share Name ... = yes map system = yes · Any help is greatly appreciated. ... Change the permissions of /usr/share_name to 775....
Top answer
1 of 2
2

Remove samba by executing following commands

sudo apt-get remove --purge samba
sudo apt-get remove --purge smbclient libsmbclient
sudo apt-get purge samba samba-common
sudo rm -rf /etc/samba/ /etc/default/samba

Install it again

sudo apt-get install samba
sudo apt-get install smbclient libsmbclient

Now original smb.conf has been restored so restart Ubuntu then add user from terminal.

root@Dell-Inspiron-3521:~# sudo smbpasswd -a username (username should be without space eg "sudo smbpasswd -a alamjitsingh")
New SMB password:*********
Retype new SMB password:*********
Added user alamjitsingh.

Now edit smb.conf file as follows. Mentioned lines must be present in the the code.

sudo gedit /usr/share/samba/smb.conf


[global]
 workgroup = WORKGROUP
 passdb backend = tdbsam 
 security = user

[Optional] If you want to share folder which are inside opt directory then you also have to add following line in global section.

usershare owner only = False

In authentication section turn "map to guest = bad user" off by adding # at starting of code

#map to guest = bad user

At last add your personal code

   [sqr_custom]
path = /opt/oracle/psft/pt/ps_home8.55.11/sqr_custom
comment = Personal_Share
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = yes
printable = no
locking = no
strict locking = no

Apart from this your shared folder is in opt folder which require permissions to write. So firstly test this prog by sharing folder of home directory. Then we will proceed further. To know correct path of shared folder drag and drop folder on running terminal.


If you are succeed to run above code then do the following

To create a group:

sudo groupadd demoGroup

To add the user account to the group:

sudo usermod -G demoGroup username(eg alamjitsingh)

For setting permissions of writing

sudo chown -R username:groupname /opt/demo

eg

sudo chown -R alamjitsingh:demogroup /opt/demo

Following lines are for granting the write access to members of the demoGroup in directory demo (It will grant all demoGroup members to write)

sudo chgrp -R demogroup /opt/demo
sudo chmod 2770 /opt/demo

Restart services

sudo service nmbd restart
sudo service smbd restart

eg of shared folder of restricted directory with write privilege

[demo]
path = /opt/demo
comment = HD Share
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = yes
printable = no
locking = no
strict locking = no
force create mode = 0660
force directory mode = 2770
force user = alamjitsingh
force group = demogroup
2 of 2
1

Try below mentioned code

[global]
workgroup = WORKGROUP
netbios name = CDA
passdb backend = tdbsam 
security = user
#map to guest = Bad User
username map = /etc/samba/smbusers
guest account = nobody
guest ok = yes
log file = /var/log/samba.log.%m
log level = 2
max log size = 1000
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printing = bsd



[custom_home]
  path = /opt/asdf/custom_home
  read only = no
  available = yes
  browseable = yes
  writable = yes
  guest ok = no
  public = yes
  locking = no
  strict locking = no
  create mask = 0777
  directory mask = 0777
  valid users = @writer (if writer is not username remove this line i think, you added user name = testuser so remove this line)

Most probably testuser is your user name to access this shared folder. In windows 10 you have to "Add a Network Location" manually, eg- "\\192.168.1.3\ Shared_folder_name" then it will ask for username and password. Find this option->Add a Network Location in windows 10. In android devices you can access this shared directory via "ES file explorer" app. If still not working intimate me. Good luck.

🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › networking
[SOLVED] Unable to write to Samba Share - Linux Mint Forums
September 7, 2025 - That is what uid=1000,gid=1000 does, the first user created in mint has an ID of 1000 and that will give you write access. If the share is not present on boot, mint will keep trying to access it for 90 seconds before giving up, nofail stops that. Bad idea to mount your shares in /. If you are using timeshift (which you should) you don't want it to include the share in your snapshots*. Better to mount somewhere in /mnt or /media, e.g.