Remove Federated Cloud Share Folder

I have in one of my instances a Federated Cloud Share of a directory from another instance. Unfortunately, this other instance no longer exists and the user can no longer access the folder, delete the folder or return the share. However, the folder with the share is located in a different folder of the user and not in his main folder anymore.

Is this the first time you’ve seen this error? (Y):

Steps to replicate it:

1) Federated Share of a folder from one instance to another
2) Take the instance with the mediated shares offline
3) Trying to delete the Federated Cloud Share on the other instance

I have also tried to use
occ files:scan
to fix this. Didn’t work out.

What can I do to delete the folder?

1 Like

I had a similar problem couple of yearsr ago. If its not possible to remove the folder through the UI try to delete it manually

MariaDB [nextcloud]> select * from oc_share_external;
+----+----------------------+-----------+-----------------+----------+---------+--------+--------+------------+----------------------------------+----------+
| id | remote               | remote_id | share_token     | password | name    | owner  | user   | mountpoint | mountpoint_hash                  | accepted |
+----+----------------------+-----------+-----------------+----------+---------+--------+--------+------------+----------------------------------+----------+
|  2 | http://XXXXXXX/cloud |        -1 | duXXXXXXXmTlCBL |          | /XXX    | XXX    |   XXX  | /XXX       | 25ca74b23eb1e2eeb76a0dXXXX0ce4   |        1 |
+----+----------------------+-----------+-----------------+----------+---------+--------+--------+------------+----------------------------------+----------+
2 Likes

Oh… thx!
So i have to do it in the database?

There are also maintenance commands for occ:
https://docs.nextcloud.com/server/19/admin_manual/configuration_server/occ_command.html#files-external-label

I know these commands and thanks for the hint but it has nothing to do with the external files. The folder is a federated share:
https://docs.nextcloud.com/server/19/admin_manual/configuration_files/federated_cloud_sharing_configuration.html?highlight=federated#

I have already removed old external storage mounts like that. And the documentation says this

Commands for managing external storage:

files_external
files_external:applicable Manage applicable users and groups for a mount
files_external:backends Show available authentication and storage backends
files_external:config Manage backend configuration for a mount
files_external:create Create a new mount configuration
files_external:delete Delete an external mount
files_external:export Export mount configurations
files_external:import Import mount configurations
files_external:list List configured mounts
files_external:option Manage mount options for a mount
files_external:verify Verify mount configuration
files_external:notify Listen for active update notifications for a configured external mount

That could be true and the documentation is correct. But one more time: federated cloud share is something diffferent as external files. Trust me! External files is for mounted (external) devices at ur server and not for shares across instances of nextcloud. So please stop posting this. It is not helpful.

BTW:
Look at the original post of iBot:

There it says, that files:external did not take any effect!

php occ sharing:cleanup-remote-storages
Removes old non existing shares… not sure about federated…

Don’t tell me what to post. Don’t worry, I won’t post anything on this topic any more

1 Like

That is a good hint!!! :smiley: I will try this tomorrow and report! I didnt know that command, thank you!

unfortunately, that didn’t help.

For completion, here is the longer explanation:
The federated shares are stored with the metadata in the database. Unfortunately none of the occ processes led to a success. You have to search in the nextcloud database (easiest with php-MyAdmin) and table with oc_share_external. In the rows of this table the shares are displayed with the data where the share comes from and where it is stored. Then simply search for the orphaned share and delete the line. Afterwards the share is no longer there and the cloud works normally again.

Hi

thanks for the help, I just wanted to add one thing.

I had the same issues: One of my friends took down his Nextcloud and after removing his server under Settings -> Sharing -> Trusted Server, I was not able remove his previously shared folders.
However, for me the occ command ‘php occ sharing:cleanup-remote-storages’ posted by tflidd worked just fine. Using this command, the Folder just disappeared and the error messages in the log stopped popping up.

Thanks again for the help.

1 Like

Thanks man. delete from oc_share_external; solved my problems.

1 Like

I had a similar issue in 27.0.1.2 for a remote share that I did not accept and for which I did not accept the share, which was in the pending list where clicking “Refuse” results in an error.

I had to remove it from the share_external table as well (I started from an old version and my tables do not have a prefix).

Has anyone found a solution for this that doesn’t involve manually editing the database? I am getting my log file hammered from on old, non-existent federated share that I can’t delete. The occ sharing:cleanup-remote-storage command didn’t work and I can’t find anything helpful for occ federated:.

Edit: I was able to install & use PHPMyAdmin to remove the broken external share.