So i reinstalled Nextcloud on my Pi, because i got now an external harddrive to connect. So i used:

sudo ln -s media/pi/Elementals/Nextcloud/data /var/www/nextcloud/data

and i changed the the owner inside var /www/nextcloud to www-data for the data folder there.

Still i cant install it. I tried to change the owner of /media/pi/Elementals/Nextcloud/data. But cant change it.

im using:

chown -R www-data:www-data data/

Even thos when i use:

sudo -u www-data bash

and then create a folder its owned by pi.

What i did wrong ?