So far the best command I have is sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files_external:create MyMount local null::null --user myuser --config datadir=/myPathTomyFolder/
This works quite : if I log in as the user I will see the share, but the strange thing here is that the external share created this way does not appear in the external share list under my admin user !
I’ve tried to understand the difference between a command-line created external share and a web UI one within the nextcloud database, but no luck so far…
I am using the --user myuser option during creation, so yes this is done.
Actually It works - since the user has then access to his share - but the share is unfortunately not visible under the external share management GUI of the admin user :-\
I’ve found a workaround, but not exactly what we want to do here.
First create an external share using the GUI
Then export this to a file : sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files_external:export > out.json
Then edit this file, duplicate the declaration and increment the mount_id
Finally import it using sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files_external:import out.json
It works, the GUI shows the external share. Not very handy…