creating samba and connecting it with nextcloud and kodi

Sorry Joulinar.

Goal: USB HDD —samba multiple user separate folders–nextcloud – each user have access to different separate folders from USB HDD.
So I want to backup from Windows to USB HDD (user X and Y) on DietPi and to see that files from Nextcloud accounts (X can see only X’s
folders, Y only Y’s folders). One path on USB HDD(from user X) will be set for Kodi.
Also I would like to be able to make new folders for each users from windows before I make new users to samba.

Samba installed from dietpi-software.
I can mount the external USB HDD and make folders from ssh.
I can access it from windows, BUT I dont have write priviliges from windows.
IF I change root folder for samba to the mounted USB HDD THEN I CANNOT CONNECT to the samba on windows even if I change password (smbpasswd)

sed -i '/path = /c\path = /mnt/test8g' /etc/samba/smb.conf
systemctl restart nmbd smbd

I tried manual editing /etc/samba/smb.conf for new user(duplicating from [dietpi]) or changing mask value to 0775 or 0777, and no effect. Also tried useradd command and smbpasswd.

Can you provide steps that will pass, cause I tried a lot, and all is wrong.

Hi,

can you share following

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

I added two users with command:

useradd usera
useradd userb

Mountet external USB on test8g but you can see that on lsblk that USB drive is in /mnt/test8 WITHOUT LETTER G in the end.


Should I try ProFTPD and save us the time, if ProFTPD can do all that I asked?

[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]
        comment = DietPi Share
path = /mnt/test8g/usera/
        browseable = yes
        create mask = 0664
        directory mask = 0775
        valid users = dietpi
        writeable = yes
max connections = 8



# Please use "dietpi-drive_manager" to setup mounts
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------


#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=1024M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAPFILE
#----------------------------------------------------------------
/var/swap none swap sw

#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
PARTUUID=907af7d0-02 / ext4 noatime,lazytime,rw 0 1
PARTUUID=907af7d0-01 /boot vfat noatime,lazytime,rw 0 2
UUID=ed666cfd-195a-49b5-8489-ad746ef9d185 /mnt/test8g ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount
#UUID=9569-6A93 /mnt/9569-6A93 vfat noatime,lazytime,rw,nofail,noauto,x-systemd.automount



NAME FSTYPE LABEL  SIZE RO TYPE MOUNTPOINT PARTUUID                             UUID
sda                7.3G  0 disk
├─sda1
│    ext4          7.3G  0 part /mnt/test8 0c0c0833-716b-40b7-9fb3-ac802039d3e7 ed666cfd-195a-49b5-8489-ad746ef9d185
└─sda2
     vfat   UEFI_NTFS
                   256K  0 part            f647a085-6ef7-49ef-999f-44ed9d24f109 9569-6A93
mmcblk0
│                 28.9G  0 disk
├─mmcblk0p1
│    vfat   boot   256M  0 part /boot      907af7d0-01                          4AD7-B4D5
└─mmcblk0p2
     ext4   rootfs
                  28.6G  0 part /          907af7d0-02                          2887d26c-6ae7-449d-9701-c5a4018755b0



total 28
drwxr-xr-x  7 root   root   4096 Jan  5 13:20 .
drwxr-xr-x 21 root   root   4096 Sep 10 14:30 ..
drwxrwxr-x 10 dietpi dietpi 4096 Dec 27 15:20 dietpi_userdata
drwxrwxr-x  2 dietpi dietpi 4096 Sep 10 14:28 ftp_client
drwxrwxr-x  2 dietpi dietpi 4096 Sep 10 14:30 nfs_client
drwxrwxr-x  2 dietpi dietpi 4096 Jan  4 18:53 samba
drwxrwx---  4 root   root   4096 Jan  5 13:28 test8g



root@DietPi:/mnt# ls
dietpi_userdata  ftp_client  nfs_client  samba  test8g

hmm your directory is owned by root user. Can you change it to dietpi user? because that’s the user who access the share

thank you

with commands chown and chmod I was able to connect and use fully samba on my PC.

I can use local storage in Nextcloud and thats ok.

Just for your information in NEXTCLOUD for external storage I couldnt use samba until I install:

apt install php-smbclient

Now I can connect everything with everything.

This is correct and working as expected. SMB client software is not installed by default.