Data to 2nd HDD connect faild

I would like to save the data on a 2nd internal harddisk.
But I have a lot of problems by the nextcloud installtion.

Nexcloud give me the information:
Can't create or write into the data directory /media/mypc/HDD-Name/nextcloud-data.

Okay, this is not the big problem.
I think i use these shell code:

a) chown www-data /media/mypc/HDD-Name/nextcloud-data
b) chown www-data:root /media/mypc/HDD-Name/nextcloud-data 
c) chown www-data:www-data /media/mypc/HDD-Name/nextcloud-data
d) chmod 777 /media/mypc/HDD-Name/nextcloud-data`


a) chown www-data /media/mypc/HDD-Name/
b) chown www-data:root /media/mypc/HDD-Name/
c) chown www-data:www-data /media/mypc/HDD-Name/
d) chmod 777 /media/mypc/HDD-Name/

The command ls -la /media/mypc/HDD-Name are:
insgesamt 28
drwxr-xr-x 4 www-data www-data 4096 Okt 18 13:04 .
drwxr-x—+ 5 root root 4096 Okt 18 14:59 …
drwxrwx— 2 www-data www-data 4096 Okt 18 13:04 nextcloud-data
drwxrwx— 2 root root 16384 Okt 18 13:04 lost+found

Cloud me anybody help me?
From the similar problem are a big problem. :frowning:

Thank you in adance!

Best regards,

Probably one of the parent folders doesn’t allow www-data to open it. You can check this with:
sudo -u www-data ls -la /media/mypc/HDD-Name/nextcloud-data

If I put this shell code into the terminal i got this information.

ls: Zugriff auf '/media/mypc/hdd-name/nextcloud-data' not possible: No authorization

You already can see a parent folder that is only for root…

Thank you for your information.

How can I change that?
I am a Linux newbie. :wink:

Thank you in advanced!

Best regards,

That depends a bit on your security policy, meaning what user should be able to see who has mounted which external storages.

chmod 755 /mnt
chmod 755 /mnt/mypc
chmod 755 /mnt/mypc/hddname

let’s every user on the system see the content of the above mentioned directories. If mypc is your personal user and you don’t want other users to sneak which storages you have mounted, you might want to mount the external storage at a different location like /mnt/nextcloud-data or similar.

Good morning tflidd,
Thank you so much!

It works!

Best regards,