Unable to connect to mounted USB HDD via Samba

Apologies if I’ve missed an existing thread with this question - I took a look but wasn’t able to spot a solution.

I’ve recently swapped from Raspbian to DietPi so that I can use my old Pi Zero W as a simple usenet downloader. Using an older howtogeek tutorial, I’ve mounted an external USB hard drive in DietPi and am trying to get a Samba network share up and running. While the HTG tutorial has the external drive named as ‘Backup’ and the user ‘backups’, I’ve called both ‘shares’ on my setup.

However, while I can connect from my Windows 10 PC to the default DietPi folder share (i.e. \DIETPI\dietpi), and I can see my external drive in the Windows network folder (\DIETPI\shares), it’s not letting me connect.

The error code that comes up (0x80070043) claims that ‘the network name cannot be found’, and when I diagnose the issue a second error message pops up: ‘You don’t have permission to access the share’.

Any ideas how to fix this problem?


thanks for your message. pls can you share your smb.conf file as well as lsblk -o name,fstype,label,size,ro,type,mountpoint

Sure, here’s my smb.conf - I’ve added the [shares] section in, but the rest was there as default:


        workgroup = WORKGROUP
        server string = %h server
        dns proxy = no
        log file = /var/log/samba/log.%m
        max log size = 1000
        syslog only = no
        syslog = 0

        panic action = /usr/share/samba/panic-action %d

        security = user
        encrypt passwords = true
        passdb backend = tdbsam
        obey pam restrictions = yes
        unix password sync = yes

        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        pam password change = yes
        map to guest = bad user

        load printers = no
        printcap name = /dev/null
        disable spoolss = yes

        comment = DietPi Share
        path = /mnt/dietpi_userdata
        browseable = yes
        create mask = 0664
        directory mask = 0775
        valid users = dietpi
        writeable = yes
        max connections = 2

        comment = USBHDD
        path = /mnt/USBHDD/shares
        valid users = @users
        force group = users
        create mask = 0660
        directory mask = 0771
        read only = no

And the output of lsblk:

sda                        1.8T  0 disk
└─sda1      exfat  BACKUP  1.8T  0 part
mmcblk0                   59.5G  0 disk
├─mmcblk0p1 vfat   boot    256M  0 part /boot
└─mmcblk0p2 ext4   rootfs 59.2G  0 part /

ok let me try to replicate your issue.

Thanks Joulinar!


Ok I guess I found it. Is there a particular reason to set following value in your smb.conf file

        valid users = @users
        force group = users

Because this will limit access to the share to user who are member of the group users. Usually on Debian this group is empty and not used as Debian systems use the private user group system by default (each user has their own group). Basically you would need to add all user who should have access to the group users.

However from security point of view this doesn’t make any difference to have multiple user created and trying to separate the access because you are using exFAT as file system format on your HDD. exFAT, as an extension of FAT and not capable of storing discretionary access control metadata. This is why all the files on an exFAT volume appear to be 777 permissions (root user). :wink:

I did that because the instructions in the HTG tutorial had those values listed for Samba sharing in Raspbian, so I assumed that they would apply in DietPi as well.

Is that not the case? I assume if I need to add specific users, that I should add my ‘shares’ user there instead?

Thanks again for the help!

If you don’t need the dietpi share, just go to adjust this section. No need to create a 2nd share and you can stay with dietpi user.

        comment = DietPi Share
        path = /mnt/dietpi_userdata
        browseable = yes
        create mask = 0664
        directory mask = 0775
        valid users = dietpi
        writeable = yes
        max connections = 2

As well you can have a look to DietPi online docs https://dietpi.com/docs/software/file_servers/#samba-feature-rich-file-server

WIll using the DietPi share details already in there let me access the external hard drive though? It’s a different path from the current one in there (i.e. /mnt/dietpi_userdata), so not sure if I need to change that to /mnt/USBHDD/shares or not?

Okay, still not connecting unfortunately.

I commented out the [shares] lines, changed the filepath to /mnt/USBHDD/shares, and also cleared all the existing network credentials on my W10 PC, but it’s still telling me that ‘Your user account doesn’t have permission to access “dietpi”’

sometimes Windows is storing login information on a hidden place. Can you check on CMD if there is something connected still

net use

As well pls can you share your actual smb.conf. Which user you are using to login?