Making Samba share from a Nextcloud files backend
it's dangerous work messing with Nextcloud's files outside of it's client. (i.e, through a file explorer or terminal). Here I'll show you how to do it the safe way.
The Goal
My goal is to get Server A's (which hosts Nextcloud and photos) SAMBA Share mounted onto Server B which hosts my LibrePhotos app. Server B is dedicated to all things serving media (It's the machine with a decent GPU)
Permissions
Setting up Nextcloud's AIO docker container, this makes all files owned by the www-data
user and group. So I need to create a samba credentials to match
Server A
sudo smbpasswd -a www-data
## enter and remember password
sudo smbpasswd -e www-data
sudo nano /etc/samba.conf
[photos_share]
path=/mnt/storage/nextcloud-aio/data/myuser/files/pictures
writeable=yes
create mask=0755
directory mask=0755
public=no
valid users = www-data
sudo systemctl restart smbd
Server B
sudo nano /root/.smbcreds_www-data
user=www-data
password=**********
sudo nano /etc/fstab
//SERVER_A/photos_myuser /mnt/nextcloud_photos/photos_share cifs credentials=/root/.smbcreds_www-data 0 0
sudo systemctl daemon-reload
sudo mount -av
ls /mnt/nextcloud_photos/photos_share
## you should see server A's files listed here on Server B