Experiencing issues after moving data directory from /var to /media on Ubuntu

Hi all

I recently installed Nextcloud with the intention of using it as a self hosted server to replace Google Drive. I unfortunately could not find the version it was but do know I installed it just today (29th August 2022)

Anyway, after doing a manual installation (on Ubuntu 22.04 Desktop LTS), playing around with nextcloud I realised I wanted to change the data directory. So i moved this data folder to my media folder and made the changes accordingly on the config file. I then did
chown -R www-data:www-data /path/to/directory to allow for the web service to have write access to the file. When restarting apache2 and checking nextcloud out. It gave the error:

Your data directory is invalid. Ensure there is a file called “.ocdata” in the root of the data directory. Cannot create “data” directory. This can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/24/go.php?to=admin-dir_permissions

I have moved data back to /var/www and did chown and surprisingly enough it gave write privileges to www-data, but moving it to my media folder and doing it there, it never responded to any changes. I’m confused and I do not know what to do.

image
– In /var/www/nextcloud, www-data owns the files after using chown

image
– In Media Storage. www-data do not own the files. No changes occurred after using chown command.

Hello @Black_Prime,

welcome to the community of Nextcloud.

Sadly enough your post is missing almost all specific technical information. Thanks for your post, but please take a little time to get acquainted with the forum and make a stronger effort to troubleshoot. It is the least you can do when asking others to help you:

  • Search your question as keywords on this forum. If you find something useful, link it directly into this post.
  • Search the internet using your issue as generic keywords. Specificity is king:
    • php modules missing Ubuntu Snap update
  • If you have an error message, repeat this process to search for your error on the forum and internet.
  • If you do not find an answer, you are likely using the wrong keywords. Try simplifying your search on the forum and internet even more.
    • nextcloud php modules missing
  • Once you’ve done this you should be able to edit and update your post with specific technical information we can use to help you.
  • Check Nextcloud admin documentation

Please edit and update your post to include:

  • Direct Links to any useful info pages, posts and other info you find.
  • Add screenshots to your post for context
  • If you have large log files to attach you can link to a pastebin
  • Fill out our support form and add into your post.

These are the exact same steps we volunteers will be following to help you! So, get to it!

Cheerio,
JimmyKater

PS Following some tutorials on the web could fail since not everyone claiming to be able to setup NC correctly really IS capable doing so.

BTW: I did some searching on “.ocdata” through the forumsearch-tool and found several entries… I picked only 3 of them, hoping to present a solution for you… if you won’t find a solution there you’re free to search yourself