Permission errors when deleting Nextcloud directories on a webhosting via SSH?

Hello together,

I want to delete the whole Nextcloud-directory on a webserver via SSH. What I tried was a simple rm -r nextcloud-directory.

I always get error messages like that:

rm: cannot unlink `web/data/updater-oc0mnat8e2sm/backups/nextcloud-12.0.3.3/cron.php’: Permission denied

The permissions are always denied, so I tried to set it to 777 what is getting refused. Even if I try to set my username as the owner I don’t have matching permissions to change the ownership.

Where is my mistake?

Thank you very much for your help! :relieved:

With best regards!
Bambelino

You aren’t root on the system? If you are just a normal user and the files from Nextcloud belong to a different user and you don’t have the permissions, there is not much you can do. You need to ask the admin to give you the permissions. You could write your own php script, run it from the browser and let it delete the Nextcloud folder.

1 Like

Thank you very much for your quick answer! :wink:

Indeed I do not own root-permissions on this system. I was just wondering that the files change their ownership when I install Nextcloud via Webapp. Would it be the same when I upload Nextcloud via FTP?

So the Apache would have the rights to delete those folders via a deleting php script. I will give it a try! Thank you!


What about the proposal to implement such a feature into Nextcloud itself? For example, if Nextcloud was installed successfully there could be a file created in the Nextcloud-directory which is called delete.php.

If you open that file via webbrowser, you could sign in with your administrator account that you also used for the install process. Afterwards confirm the deletion of the whole Nextcloud-directory by clicking on a warning button (“Are you sure?”) and in following the php-script will erase everything.

That would be nice for all users without root-access to their webhosting… :wink:

A properly set up webhosting should allow you to delete folders via FTP. This must be possible without root access.