Files_external - How to create a local storage with occ command?

I’m trying to create a local external storage using the occ command. At this moment I have this command :

docker exec --user 1000 nextcloud php occ files_external:create Home 'local' password::none -c root=/var/www/data

But I got the following error :

Authentication backend with identifier “password::none” not found (see occ files_external:backends for possible values)

This is what I got doing the command occ files_external:backends storage:

- local:
  - name: Local
  - identifier: local
  - configuration:
    - datadir: text
  - storage_class: \OC\Files\Storage\Local
  - supported_authentication_backends:
    - null::null
  - authentication_configuration:
    - null::null:

And how can I enable sharing ?

I also tried with password::null but I got the same error. I don’t know what do I have to type in. Thanks for any advice


I figured it out how to create it the mount. Now I wonder how to enable sharing ?

Here is my new command :

docker exec --user 1000:1000 nextcloud php occ files_external:create Home local null::null -c datadir=/var/www/data -c enable_sharing=true --output=json

1 Like

Hello Exe !

I am trying to do the exact same thing.

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…

Did you find another way ?
Michel :slight_smile:

For the moment I have the following command. I think you forget to assign the mount id to a user.

mount_id=$(docker exec --user "$uid":"$gid" nextcloud php occ files_external:create Home local null::null -c datadir=/var/www/data --output=json)
docker exec --user "$uid":"$gid" nextcloud php occ files_external:applicable --add-user=myuser "$mount_id"

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…

Are you using the latest version of Nextcloud ?

Sure ! files_external:export and files_external:import are new in v16