Add credentials to occ files:scan --all?

Hi,
I’m wondering how I can add the SAMBA users credentials in this command:
sudo -u www-data php /var/www/nextcloud/occ files:scan --all

When I run it it just says permission denied at the samba cache and it’s because that I need to add the credentials for the samba user, how can I do that?

@icewind @nickvergessen can you help here?
We should put this information in the documentation as well:
https://docs.nextcloud.com/server/13/admin_manual/configuration_files/external_storage_configuration_gui.html

Thanks for notice, and here is the error message:

Scanning files for 4 users
Starting scan for user 1 out of 4 (xxx)
mkdir failed on directory /var/cache/samba: Permission denied
mkdir failed on directory /var/cache/samba: Permission denied
mkdir failed on directory /var/cache/samba: Permission denied
mkdir failed on directory /var/cache/samba: Permission denied
mkdir failed on directory /var/cache/samba: Permission denied

and it keeps going.

I’m currently using a domain I guess that many people are using it so it should be good to have in the docs how to add the credentials with and without domain joined SMB share.

Thanks!

Any news regarding this?

Anyone who can help me with this? Please :slight_smile:

Without knowing the particulars of your setup, I’m baffled as to why the www-data user is even attempting to modify this folder during a scan. It should be talking to the Samba daemon via CIFS, and letting the smbd daemon handle this folder. The files are shared once via Samba, then is Nextcloud configured to share them using External Storage -> SMB/CIFS (through Samba) or External Storage -> Local (mess with the files directly)?

Here would be how you can allow www-data to make changes in that folder, though I’m not sure that’s what should happen here.
First, add www-data to the sambashare group:

sudo usermod www-data --append --groups sambashare

You’d then want to make sure that members of the group sambashare have permissions to make changes in those folders:

sudo chgrp --recursive sambashare /var/cache/samba
sudo chmod --recursive g+rw /var/cache/samba

The more I look into it, the more this seems to be a Samba problem rather than with Nextcloud. Are you able to mount and access all your files via SMB to begin with?

@Calby

Apologies for confusing the issue. Is this what you were looking for?
https://docs.nextcloud.com/server/13/admin_manual/configuration_files/external_storage/smb.html#smb-authentication