DietPi v8.9.2 updated with Samba issues?

Just updated to DietPi v8.9.2, however it seemed to wipe out access to Samba shares.

Local SD and usb drives not remotely accessible - local access works fine (fstab/drivemanager all ok)

/etc/samba/smb.conf as follows:

[global]

        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

[dietpi_data]
        comment = DietPi Share
        path = /mnt/dietpi_userdata
        browseable = yes
        create mask = 0664
        directory mask = 0775
        valid users = dietpi
        writeable = yes
        max connections = 8
        case sensitive = auto

[dietpi]
        comment = DietPi Share
        path = /home/dietpi
        browseable = yes
        create mask = 0664
        directory mask = 0775
        #valid users = dietpi
        writeable = yes
        max connections = 8
        case sensitive = auto

[usb1]
        comment=Local HD (SSD)
        path=/mnt/usb1
        browseable=yes
        writeable=yes
        create mask=0777
        directory mask=0777
        only guest=no
        guest ok=no
        public=no
        #valid users = "diepi"
        max connections = 8
        case sensitive = auto

Not accessible from Windows (10) and *nix os’s. Was working fine before the upgrade and before rebooting clients - on client reboot, samba share to the dietpi is deined…using \ip\ prompts for u/p and then fails, even with root.

Even chaging to below doesn’t work:

valid users = diepi
force users = dietpi
: sudo pdbedit -w -L | awk -F: '{print $1}'
dietpi
: samba-tool user list
ltdb: tdb(/var/lib/samba/private/sam.ldb): tdb_open_ex: could not open file var/lib/samba/private/sam.ldb: No such file or directory

Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory
Failed to connect to 'tdb:///var/lib/samba/private/sam.ldb' with backend 'tdb': Unable to open tdb '/var/lib/samba/private/sam.ldb': No such file or directory

Our SAMBA configuration is taking the users from os layer. Therefore samba-tool user list is not working as it is not configured this way. As a default value, we set valid users = dietpi. This will allow access using dietpi user only (with os password). You could try to adjust the password as follow:

smbpasswd -a dietpi

As well can you share following

journalctl -u nmbd -u smbd
systemctl status nmbd smbd
ss -tulpn | grep LISTEN

Same issue when resetting smb password using ‘smbpasswd -a dietpi’. What’s strange is root doesn’t even work :frowning:

root@:~# journalctl -u nmbd -u smbd
-- Logs begin at XXX 2019-02-XX XX:XX:XX XXXX, end at XXX 2022-10-XX XX:XX:XX XXX. --
Oct XX XX:XX:XX XXXXXXXX systemd[1]: /lib/systemd/system/nmbd.service:9: PIDFile= references path below legacy directory /var/run/, updating /var/run/samba/nmbd.pid → /run/samba/nmbd.pid; please update the unit file accordingly.
Oct XX XX:XX:XX XXXXXXXX systemd[1]: Starting Samba NMB Daemon...
Oct XX XX:XX:XX XXXXXXXX systemd[1]: Started Samba NMB Daemon.
Oct XX XX:XX:XX XXXXXXXX systemd[1]: /lib/systemd/system/smbd.service:9: PIDFile= references path below legacy directory /var/run/, updating /var/run/samba/smbd.pid → /run/samba/smbd.pid; please update the unit file accordingly.
Oct XX XX:XX:XX XXXXXXXX systemd[1]: Starting Samba SMB Daemon...
Oct XX XX:XX:XX XXXXXXXX systemd[1]: Started Samba SMB Daemon.
Oct XX XX:XX:XX XXXXXXXX smbd[4801]: pam_unix(samba:session): session opened for user dietpi by (uid=0)
Oct XX XX:XX:XX XXXXXXXX smbd[4801]: pam_unix(samba:session): session closed for user dietpi
Oct XX XX:XX:XX XXXXXXXX smbd[6991]: pam_unix(samba:session): session opened for user dietpi by (uid=0)
Oct XX XX:XX:XX XXXXXXXX smbd[6991]: pam_unix(samba:session): session closed for user dietpi
root@:~# ***systemctl status nmbd smbd***
● nmbd.service - Samba NMB Daemon
   Loaded: loaded (/lib/systemd/system/nmbd.service; disabled; vendor preset: enabled)
   Active: active (running) since XXX 2022-10-XX XXX:XX:XX XXXX; XXX
     Docs: man:nmbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 582 (nmbd)
   Status: "nmbd: ready to serve connections..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/nmbd.service
           └─582 /usr/sbin/nmbd --foreground --no-process-group

Oct XX XX:XX:XX XXXXXXXX systemd[1]: Starting Samba NMB Daemon...
Oct XX XX:XX:XX XXXXXXXX systemd[1]: Started Samba NMB Daemon.

● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; disabled; vendor preset: enabled)
   Active: active (running) since XXX 2022-10-XX XX:XX:XX XXXX; XXX
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 606 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (code=exited, status=0/SUCCESS)
 Main PID: 607 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 3 (limit: 4915)
   CGroup: /system.slice/smbd.service
           ├─607 /usr/sbin/smbd --foreground --no-process-group
           ├─610 /usr/sbin/smbd --foreground --no-process-group
           └─611 /usr/sbin/smbd --foreground --no-process-group

Oct XX XX:XX:XX XXXXXXXX systemd[1]: Starting Samba SMB Daemon...
Oct XX XX:XX:XX XXXXXXXX systemd[1]: Started Samba SMB Daemon.
Oct XX XX:XX:XX XXXXXXXX smbd[4801]: pam_unix(samba:session): session opened for user dietpi by (uid=0)
Oct XX XX:XX:XX XXXXXXXX smbd[4801]: pam_unix(samba:session): session closed for user dietpi
Oct XX XX:XX:XX XXXXXXXX smbd[6991]: pam_unix(samba:session): session opened for user dietpi by (uid=0)
Oct XX XX:XX:XX XXXXXXXX smbd[6991]: pam_unix(samba:session): session closed for user dietpi
root@:~# ***ss -tulpn | grep LISTEN***
tcp    LISTEN  0       128                 0.0.0.0:8081           0.0.0.0:*      users:(("python",pid=275,fd=4))                    
tcp    LISTEN  0       256                 0.0.0.0:53             0.0.0.0:*      users:(("unbound",pid=563,fd=4))                   
tcp    LISTEN  0       128                 0.0.0.0:22             0.0.0.0:*      users:(("sshd",pid=553,fd=3))                      
tcp    LISTEN  0       5                   0.0.0.0:8888           0.0.0.0:*      users:(("rpimonitord",pid=1372,fd=5))              
tcp    LISTEN  0       4096              127.0.0.1:8125           0.0.0.0:*      users:(("netdata",pid=909,fd=11))                  
tcp    LISTEN  0       50                  0.0.0.0:445            0.0.0.0:*      users:(("smbd",pid=607,fd=31))                     
tcp    LISTEN  0       4096                0.0.0.0:19999          0.0.0.0:*      users:(("netdata",pid=909,fd=3))                   
tcp    LISTEN  0       128                 0.0.0.0:8421           0.0.0.0:*      users:(("pisugar-server",pid=269,fd=13))           
tcp    LISTEN  0       1024                0.0.0.0:8422           0.0.0.0:*      users:(("pisugar-server",pid=269,fd=11))           
tcp    LISTEN  0       1024                0.0.0.0:8423           0.0.0.0:*      users:(("pisugar-server",pid=269,fd=10))           
tcp    LISTEN  0       4096                0.0.0.0:5001           0.0.0.0:*      users:(("iperf",pid=1606,fd=3))                    
tcp    LISTEN  0       80                127.0.0.1:3306           0.0.0.0:*      users:(("mysqld",pid=671,fd=23))                   
tcp    LISTEN  0       50                  0.0.0.0:139            0.0.0.0:*      users:(("smbd",pid=607,fd=32))                     
tcp    LISTEN  0       128                 0.0.0.0:10000          0.0.0.0:*      users:(("miniserv.pl",pid=1593,fd=5))              
tcp    LISTEN  0       511                 0.0.0.0:80             0.0.0.0:*      users:(("nginx",pid=780,fd=5),("nginx",pid=779,fd=5),("nginx",pid=778,fd=5),("nginx",pid=777,fd=5),("nginx",pid=776,fd=5))
tcp    LISTEN  0       4096                      *:5201                 *:*      users:(("iperf3",pid=1604,fd=3))                   
tcp    LISTEN  0       128                    [::]:22                [::]:*      users:(("sshd",pid=553,fd=4))                      
tcp    LISTEN  0       2        [::ffff:127.0.0.1]:3350                 *:*      users:(("xrdp-sesman",pid=537,fd=7))               
tcp    LISTEN  0       2                         *:3389                 *:*      users:(("xrdp",pid=554,fd=11))                     
tcp    LISTEN  0       50                     [::]:445               [::]:*      users:(("smbd",pid=607,fd=29))                     
tcp    LISTEN  0       50                     [::]:139               [::]:*      users:(("smbd",pid=607,fd=30))                     
tcp    LISTEN  0       511                    [::]:80                [::]:*      users:(("nginx",pid=780,fd=6),("nginx",pid=779,fd=6),("nginx",pid=778,fd=6),("nginx",pid=777,fd=6),("nginx",pid=776,fd=6))

This is strange. I reinstalled smb server and added usb1 to the smb.config (as above) and now the /mnt/dietpi_userdata and /home/dietpi are accessible, but /mnt/usb1 still isn’t from WIndows 10, another RPi and a Ubuntu OS). However usb1 is accessible via andriod mobile phone Cx File Explorer.

drwxrwxr-x 13 dietpi dietpi 4096 Oct XX XX:XX dietpi_userdata
drwxrwxrwx 1 dietpi dietpi 4096 May XX XX:XX usb1

usb1 was mounted using dietpi-drive_manager before the latest update and accessible locallly

UUID=XXXXXXXXXXXXXX /mnt/usb1 ntfs noatime,lazytime,rw,permissions,big_writes,nofail,noauto,x-systemd.automount

Could it be possibly related to SMB Version? (I have V1 enabled in Windows 10, but disabling it makes no difference)

what exactly is the error message on Windows while trying to access usb1 share

EDIT

on the 2nd Pi, did you tried to mount the USB1 share manually?

sudo mount -t cifs -o username=dietpi,password=<share_password> //SHARE_IP/usb1 /mnt/samba

I can access when its shared as “public = yes” (and removing any user reference), but when enabling “valid users = diepi” it fails.

I get the following (Windows 10)

  1. Explorer: \ip\usb1\
  2. "Enter Network Credentials, Enter your crediendials to connect to: , dietpi, ,…etc…
  3. Error: Open Folder \\usb1 is not accessible. You might not have permissions to use this network resource. Contact the administrator…etc…"

I’ve even removed Windows Credentials for it in Credentials Manager and even tried using \\dietpi as the username…still no access

EDIT: The mobile phone accessing it is via SFTP - so nvm about that…

Did you tried to mount manually from the other Pi as described above?

can you share your configuration again

ls -la /mnt/
cat /etc/fstab
cat /etc/samba/smb.conf
df -h
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid

I would like to replicate your environment if possible.

Shouldn’t I use dietpi-drive_manager to mount it?

Edit: using dietpi-drive_manager to reinstall the drive on another DietPi seemed to work. Just Windows still doesn’t work

/etc/fstab
//IP/usb1 /mnt/RemotePi cifs cred=/var/lib/dietpi/dietpi-drive_manager/mnt-RemotePi.cred,iocharset=utf8,uid=dietpi,gid=dietpi,file_mode=0770,dir_mode=0770,vers=3.1.1,nofail,noauto,x-systemd.automount

Fixed it - seems there was a bug with Windows 10 - I uninstalled SMB V1.0…

I just copied a working entry from another RPI (dietpi) for the usb1 share and pasted it into the ‘broken’ one to ensure I had a working entry for the drive as follows:

cat /etc/samba/smb.conf

[usb1]
comment = Local Storage Drive
path = /mnt/usb1
browseable = yes
writeable = yes
create mask = 0777
directoy mask = 0777
only guest = no
guest ok = no
public = no
read only = no
valid users = dietpi
force user = dietpi
force group = dietpi
case sensitive = auto

I then had to re-mount on the other *nix machines (copied from the dietpi-drive manager to ensure they were standard mounts (as per dietpi v8.9.2 dietpi-drive_mount), so had this on remotes as:

//IP/usb1 /mnt/PiName cifs username=dietpi,password=XXXXXXXXX,iocharset=utf8,uid=localuid,gid=localgid,file_mode=0770,dir_mode=0770,vers=3.1.1,nofail,noauto,x-systemd.automount

Whats really strange is that I didn’t even touch the Ubuntu mount entry, yet it now decided to work:

//IP/usb1 /mnt/Pi37 cifs user,rw,_netdev,credentials=/XXXXX/CREDENTIALSFILE,comment=systemd.automount,exec,uid=admin,gid=admin 0 0

And now Windows access also works…very weird intermittent behaviour

@Joulinar thanks for your quick assistance :slight_smile: I’m not sure what happened nor what really fixed it.