[How-To] Nextcloud Delete Federated Share References

Occasionally, if someone sent a federated share with you via Nextcloud, and then they axe their instance then your logs will be polluted with connection errors. You can remove the share via the GUI but sometimes it doesn’t clean up old references.

So here is the fix:

  1. Log into your nextcloud database
  2. Remove the old reference.

On my host I use MySQL 8.0.

sudo mysql
use ncdb;
mysql> select * from oc_share_external;
+----+--------+------------+---------------------------+-----------+-----------------+----------+-----------------+---------+--------+-----------------+----------------------------------+----------+
| id | parent | share_type | remote                    | remote_id | share_token     | password | name            | owner   | user   | mountpoint      | mountpoint_hash                  | accepted |
+----+--------+------------+---------------------------+-----------+-----------------+----------+-----------------+---------+--------+-----------------+----------------------------------+----------+
|  1 |     -1 |          0 | https://cloud.oorpro.com/ | 2         |                 |          | /Server Plugins | bbowlds | lbrown | /Server Plugins | 6675cc5a0b6ddf3972d8b7c25a4941f1 |        1 |
|  2 |     -1 |          0 | https://nc.plein.org/     | 11        |                 |          | /r1.2.7.zip     | bill    | lbrown | /r1.2.7.zip     | 3938612175cfe9bc825b0d2a6eda86ac |        1 |
|  3 |     -1 |          0 | https://nc.plein.org/     | 12        |                 |          | /r2.1.0.zip     | bill    | lbrown | /r2.1.0.zip     | ba2e2bc7ceb1e107e636f88e664bf9a0 |        1 |
+----+--------+------------+---------------------------+-----------+-----------------+----------+-----------------+---------+--------+-----------------+----------------------------------+----------+

I need to remove the entry with id = 1

mysql> start transaction;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from oc_share_external where id=1;
Query OK, 1 row affected (0.00 sec)

mysql> select * from oc_share_external;
+----+--------+------------+-----------------------+-----------+-----------------+----------+-------------+-------+--------+-------------+----------------------------------+----------+
| id | parent | share_type | remote                | remote_id | share_token     | password | name        | owner | user   | mountpoint  | mountpoint_hash                  | accepted |
+----+--------+------------+-----------------------+-----------+-----------------+----------+-------------+-------+--------+-------------+----------------------------------+----------+
|  2 |     -1 |          0 | https://nc.plein.org/ | 11        |                 |          | /r1.2.7.zip | bill  | lbrown | /r1.2.7.zip | 3938612175cfe9bc825b0d2a6eda86ac |        1 |
|  3 |     -1 |          0 | https://nc.plein.org/ | 12        |                 |          | /r2.1.0.zip | bill  | lbrown | /r2.1.0.zip | ba2e2bc7ceb1e107e636f88e664bf9a0 |        1 |
+----+--------+------------+-----------------------+-----------+-----------------+----------+-------------+-------+--------+-------------+----------------------------------+----------+
2 rows in set (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

:rocket:


Original reference source

4 Likes