Access a NextCloud user with Samba

I currently use Ubuntu Server and NextCloud 19.
Last time I used NextCloudPi with Samba/SMB enabled. But now I want to do without these variation.

I have installed NextCloud and saved the data on an external hard drive.

But now I need to access my folder via SMB. In NextCloud I have found no option for this.

Now I have installed Samba. Samba works for normal folders (e.g. /home/usr/). But I can not access user folders of NextCloud (e.g. /nextcloud/data/usr/files/). It works only with root rights in terminal.

How can I configure the single folder or Samba to work via SMB?

Please use same user for smb and nextcloud or configure rights that both user can access.

1 Like

Hello, thank you very much for the answer.

I have created a Samba user with the same user name. Unfortunately it does not work.
Samba itself does not get into the folder.
I only appear in the folder as SU (sudo su …).

Accessing the Nextcloud data folder via SMB is a bad idea and will likely break something.

What you should do instead is set up a SMB share and then add it as an external storage in Nextcloud.

1 Like

It worked well before. I managed the files via SMB and regularly checked for changes with a cronjob.
“nextcloud.occ files:scan --all”

Can I mount external storage that is on the same machine?

If I include a local path as external storage, I cannot create or edit files there.

Please send more details. Can you post screenshots?

Right, this is necessary because you have modified files in the data folder and introduced a discrepancy between what’s in there and what Nextcloud has in its database. It’s asking for something to break, but that’s just my opinion. I stand by my earlier suggestion of flipping it around.

There are security issues related to local external storage. In that case, it may better to loopback SMB or something similar.

I’ll answer tomorrow.

Currently, I can already access the folder, create and change files etc. via the web interface.

I had to give root access (chmod and chown).

Via SMB I can’t access the folder correctly yet, except via the Samba option guests. I still have to try that.

What is a loopback SMB?

Hello!!
I recommend you to mount your nextcloud account in your linux user using webdav. With this you can use your nextcloud as a linux folder

sudo apt-get install davfs2

mkdir /home/ralcazar/nextcloud

sudo mount -t davfs -o noexec https://YOURSERVER/nextcloud/remote.php/webdav/ /home/ralcazar/nextcloud/

sudo umount /home/ralcazar/nextcloud

to finish using it (Make sure that you aren’t still in the mounted device when you are trying to umount)

Hope it helps :wink:

Edit: It’s to be used with ssh console or SFTP, not samba itself

Thank you very much for the answers.

I now have a solution that allows me to access (R+W) the external hard drive (NextCloud + Windows-SMB).

But to avoid problems with creating, writing and deleting, there were some things to consider.

A manual will come soon.