Disable *not delete* external storage mount from commandline using occ

Hello @szaimen,

thanks for your reply.
I found a solution in another thread: Can't remove external mount - #11 by SimpleCake

Solution by User SimpleCake:

Open a docker interactive terminal (if you’re using docker with the official image)

sudo docker exec -it docker-nextcloud /bin/bash

List the currently active mount points for all users

Standard Usage

occ files_external:list -a

Docker

su -c "php /var/www/html/occ files_external:list -a" -s /bin/sh www-data

Delete a selected mount using the mount’s ID

Standard Usage

occ files_external:delete <Mount ID>

Docker

su -c "php /var/www/html/occ files_external:delete <Mount ID>" -s /bin/sh www-data

Command results for reference

These commands were issued from inside a docker container, so they command syntax will look different if you’re using the terminal (as discussed previously) or if you are using a different image base in your docker container.

List ALL of the mount points as the root user

root@mydockercontainer# su -c "php /var/www/html/occ files_external:list -a" -s /bin/sh www-data
+----------+-------------+-------------------------------------+-----------------------+----------------------------------------------------------------------------------------------------------+---------+------------------+-------------------+----------+
| Mount ID | Mount Point | Storage                             | Authentication Type   | Configuration                                                                                            | Options | Applicable Users | Applicable Groups | Type     |
+----------+-------------+-------------------------------------+-----------------------+----------------------------------------------------------------------------------------------------------+---------+------------------+-------------------+----------+
| 2        | /BoxDotCom  | WebDAV                              | Username and password | host: "dav.box.com\/dav", root: "NextCloud", secure: true, user: "emai1@local.com", password: "***"      |         | user1            |                   | Personal |
| 3        | /GDrive     | Unknown storage backend googledrive | OAuth2                | configured: "true", client_id: "xxxxxx...al.com", client_secret: "***", token: "***"                     |         | user2            |                   | Personal |
+----------+-------------+-------------------------------------+-----------------------+----------------------------------------------------------------------------------------------------------+---------+------------------+-------------------+----------+

Pick out your ID from the results

I choose number three which is associated with the provider type and user that is having the issue.

Delete the mount and confirm when prompted

root@mydockercontainer# su -c "php /var/www/html/occ files_external:delete 3" -s /bin/sh www-data
+----------+-------------+-------------------------------------+---------------------+--------------------------------------------------------------------------------------+---------+------------------+-------------------+
| Mount ID | Mount Point | Storage                             | Authentication Type | Configuration                                                                        | Options | Applicable Users | Applicable Groups |
+----------+-------------+-------------------------------------+---------------------+--------------------------------------------------------------------------------------+---------+------------------+-------------------+
| 3        | /GDrive     | Unknown storage backend googledrive | OAuth2              | configured: "true", client_id: "xxxxxx...al.com", client_secret: "***", token: "***" |         | user2            |                   |
+----------+-------------+-------------------------------------+---------------------+--------------------------------------------------------------------------------------+---------+------------------+-------------------+
Delete this mount? [y/N] y

List ALL of the mount points again to ensure it’s gone

root@mydockercontainer# su -c "php /var/www/html/occ files_external:list -a" -s /bin/sh www-data
+----------+-------------+---------+-----------------------+----------------------------------------------------------------------------------------------------------+---------+------------------+-------------------+----------+
| Mount ID | Mount Point | Storage | Authentication Type   | Configuration                                                                                            | Options | Applicable Users | Applicable Groups | Type     |
+----------+-------------+---------+-----------------------+----------------------------------------------------------------------------------------------------------+---------+------------------+-------------------+----------+
| 2        | /BoxDotCom  | WebDAV  | Username and password | host: "dav.box.com\/dav", root: "NextCloud", secure: true, user: "email@local.com", password: "***"      |         | user1            |                   | Personal |
+----------+-------------+---------+-----------------------+----------------------------------------------------------------------------------------------------------+---------+------------------+-------------------+----------+

Go back to the browser and verify that the issue is fixed

1 Like