creating samba and connecting it with nextcloud and kodi

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
selih34
Posts: 18
Joined: Sun Dec 20, 2020 4:43 pm

creating samba and connecting it with nextcloud and kodi

Post by selih34 »

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)

Code: Select all

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.
User avatar
Joulinar
Posts: 4836
Joined: Sat Nov 16, 2019 12:49 am

Re: creating samba and connecting it with nextcloud and kodi

Post by Joulinar »

Hi,

can you share following

Code: Select all

cat /etc/samba/smb.conf
cat /etc/fstab
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
ls -la /mnt
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
selih34
Posts: 18
Joined: Sun Dec 20, 2020 4:43 pm

Re: creating samba and connecting it with nextcloud and kodi

Post by selih34 »

I added two users with command:

Code: Select all

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?

Code: Select all

[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

Code: Select all

# 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

Code: Select all

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

Code: Select all

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

Code: Select all

root@DietPi:/mnt# ls
dietpi_userdata  ftp_client  nfs_client  samba  test8g
User avatar
Joulinar
Posts: 4836
Joined: Sat Nov 16, 2019 12:49 am

Re: creating samba and connecting it with nextcloud and kodi

Post by Joulinar »

hmm your directory is owned by root user. Can you change it to dietpi user? because that's the user who access the share
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
selih34
Posts: 18
Joined: Sun Dec 20, 2020 4:43 pm

Re: creating samba and connecting it with nextcloud and kodi

Post by selih34 »

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:

Code: Select all

apt install php-smbclient 
Now I can connect everything with everything.
User avatar
Joulinar
Posts: 4836
Joined: Sat Nov 16, 2019 12:49 am

Re: creating samba and connecting it with nextcloud and kodi

Post by Joulinar »

selih34 wrote: Wed Jan 06, 2021 2:09 am Just for your information in NEXTCLOUD for external storage I couldnt use samba until I install:

Code: Select all

apt install php-smbclient
This is correct and working as expected. SMB client software is not installed by default.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply