Can't create data directory or it can't be written to it

I’m right now installing nextcloud-18-0-1. I use it on a Apache Server with SSL on Rasbian 10 Buster.
I try to use a data directory on an external harddrive.
The harddrive is mounted by fstab on startup to “/media/usb” and i can create and write files with my user. So far so good.
I created also a nextcloud folder on the harddrive which i want to use for storing the nextcloud data.
It has the same owner and group like the /var/www/nextcloud where i installed the nextcloud.
The user is “www-data”.
When i try to setup nextcloud with the gui wizard in my webbrowser it says: “The directoy /media/usb/nextcloud” can’t be created or it can’t be written to it" (translated from german)
What the hell am i missing?

What happens when you try to create files with www-data user?
“my user” is probably some other user?

how can i do that? usually the apache www-data user has no terminal access and that for a good reason.

This should work, by setting a temporary shell:
sudo su -s /bin/bash www-data

1 Like

Thank you.
Permission denied for touch /media/usb/nextcloud/smthn

What about the parent directories? Are they set to 755 (drwxr-xr-x)?

  • media
  • usb
  • nextcloud
1 Like

usb is: drwxrwx--- 1 root root 23 Feb 14 23:09 .
media is: drwxr-xr-x 3 root root 4096 Feb 14 21:21 .

Please execute sudo chmod 755 /media/usb and try again to write to the folder.

1 Like

That was it :smiley:

But the user i typed first was already in the db. Maybe because i accendently tried to set it up with the standard data directory path within the /var/www folder. So i had to delete it manually from the mysqldb, before setting it up.

Right now it is installing the components!

Thank you very much for your awesome help.

1 Like

You’re welcome! :+1:

Should you need to use the occ command someday, remember to execute it via www-data as shown above.

Have fun with your Nextcloud…

Thank you, but the problems are continuing.
I can not upload any files. Not in the WebInterface and not through WebDav.

Here is a link to the new thread, if you still wanna help :slight_smile:

Permission denied can't read directory