Frequently Asked Question
NextCloud External Storage CIFS
Prerequisites
Make sure you have the correct tools installed
dnf install samba-client cifs-utils
Now, it is advisable to 'test' the remote mount works by creating a temporary folder like /mnt/test. In this example I will use a server at 172.16.1.100, with a SMB (Windows) Share called "sharename" and a user "NextCloud" and password "Strong!Password". Obviously use your own values here.
mkdir /mnt/test mount -t cifs //172.16.1.100/sharename /mnt/test -o username=Nextcloud,password=Strong!Password
If this works, and it should, then you can proceed to adding it to NextCloud.
NextCloud
Make sure you have enabled the "External Storage" App. It is disabled by default.
Open a ssh session with your server.
I am assuming here that nextcloud is installed in /var/www/nextcloud and that the user is nginx (because it's running under nginx) but change below according to your environment.
sudo -u nginx php /var/www/nextcloud/occ files_external:create "test" smb password::password \ -c host=172.16.1.100 \ -c share=sharename \ -c user=NextCloud \ -c password=Strong!Password \ -c domain=
This will return an ID like: Storage created with id 1
Now we need to assign permissions, and we do this like
sudo -u nginx php /var/www/nextcloud/occ files_external:applicable 1 --add-group somegroup
You can use --add-group --remove-group here to add and remove groups. Running this command without either will show the group permissions for the share.