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 BST 2023 aarch64 GNU/Linux
  • Architecture | arm64
  • SBC model | RPi 3 Model B (aarch64)
    Power supply used | Unkown
  • SD card used | Sandisk Ultra 16gb

Additional Information (if applicable)

  • Software title | Samba
  • Was the software title installed freshly or updated/migrated?
    Freshly installed
  • Can this issue be replicated on a fresh installation of DietPi?
    Yes
  • Bug report ID | 48534202-af56-4840-9e3e-d0b67b3abfe9

Steps to reproduce

  1. Install Samba
  2. Typed in “sed -i ‘/path = /c\path = /mnt/stash/KSMB’ /etc/samba/smb.conf” and then “systemctl restart nmbd smbd”, which gives me read access to the folder via Windows 11 but no write permission.
  3. Typed in this into the samba config:
    “[dietpi]
    comment = DietPi Share
    path = /mnt/stash/KSMB
    browseable = yes
    writeable = yes
    read only = no
    force create mode = 0777
    force directory mode = 0777
    create mask = 0777
    directory mask = 0777
    public = yes”

Expected behaviour

I should be allowed to write and delete on the folder via Windows 11.

Actual behaviour

  • Windows 11 tells me I can’t edit files on the folder because I don’t have permission.

Extra details

  • I’ve searched high and low online for a solution without finding any. I got it to work on a previous installation but can’t remember what I did that made it work then.

Can you show the output of ls -la /mnt/stash/KSMB please.

drwxrwxrwx 14 nobody nogroup  4096 Jun  6 03:28 .
drwxr-xr-x 12 dietpi dietpi   4096 Jun  8 06:38 ..
-rw-r--r--  1 nobody nogroup 10244 Jun  7 09:10 .DS_Store
-rw-r--r--  1 nobody nogroup  4096 Jun  4 20:09 ._.DS_Store
drwxr-xr-x  8 nobody nogroup  4096 Jun  7 17:14 Filmer
drwxr-xr-x  2 nobody nogroup  4096 Jun  4 19:19 IA64
drwxr-xr-x 67 nobody nogroup  4096 Nov 17  2022 Noise
drwxr-xr-x  5 nobody nogroup  4096 May 22 12:27 RUUN
drwxr-xr-x  2 nobody nogroup  4096 Jun  4 19:19 W32ALPHA
drwxr-xr-x  2 nobody nogroup  4096 Jun  4 19:19 W32MIPS
drwxr-xr-x  2 nobody nogroup  4096 Jun  4 19:19 W32PPC
drwxr-xr-x  3 nobody nogroup  4096 Jun  4 19:19 W32X86
drwxr-xr-x  2 nobody nogroup  4096 Jun  4 19:19 WIN40
drwxr-xr-x  2 nobody nogroup  4096 Jun  4 19:19 color
drwxr-xr-x 12 nobody nogroup  4096 Jun  6 06:14 stoof
drwxr-xr-x  3 nobody nogroup  4096 Jun  4 19:19 x64

It is like the error message stated: You have no permissions to write, only read and execute (assuming you’re using user dietpi)
The permissions you set in your config only account for new created files and folders, not for the already existing ones, they have already their permissions.
Theroretically you should be able to create files and folders in /mnt/stash/KSMB, but not in any subfolder:

drwxrwxrwx 14 nobody nogroup  4096 Jun  6 03:28 .

You could do chmod 775 /mnt/stash/KSMB and chown nobody:dietpi /mnt/stash/KSMB (assuming you are using the user dietpi)

Is this an external device? Can you share following

lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid

Was this disk connected to another system before? Strange permissions nobody nogroup

This is the result:

NAME FSTYPE LABEL  SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                1.8T  0 disk
└─sda1
     ext4          1.8T  0 part /mnt/stash                                      05f1ba04-b443-449a-a2fd-73063662fb56
mmcblk0
│                 14.8G  0 disk
├─mmcblk0p1
│    vfat          128M  0 part /boot      2a5aca42-01                          DF63-6F01
└─mmcblk0p2
     ext4         14.7G  0 part /          2a5aca42-02                          31f1a85e-ab93-4b5a-84a9-02beaaa0c434

The reason behind the permission was me previously trying to figure out how to fix the permissions for the drive and whatever I did didn’t work.

I tried this and Windows still tells me it doesn’t have permission. Should I do it as root instead?

Yes pls do this as user root. Which user you use on Windows to login to SAMBA share?

chmod 755 -R /mnt/stash/
chown dietpi:dietpi -R /mnt/stash/
1 Like

This worked, thanks. But I have another problem that I don’t know if it needs a seperate thread or not but I have a feeling it’s related. I have an emby server on my Raspberry pi and when I try to delete stuff within emby it tells me that I don’t have write permissions to that folder. Why is that?

What folder is that?

chmod 775 -R /mnt/stash/

I don’t know where emby is installed but the folder is /mnt/stash/KSMB/Filmer.

Nevermind, typing in this fixed it.

Yes, access between different apps is realized on DietPi via group permission. Therefore giving r/w to dietpi group fixed it in your case.

1 Like