You don’t have permission to upload or create files here

That would be my question as well. I do not understand why opening all the doors (777) was required to get Nextcloud to write to the essential external HD attached to my RPi. I am not a Linux guru.

Had a very similar problem. Running NextCloud 12 through the NextCloudPi integration. Had everything set up on a mounted external HDD. Set up a smb share for other pis to be able to write to the data folder, would not work. then could also not browse to it through the terminal. only changing permissions to 777 worked. interestingly could browse folder in samba share view, just not write to it.

imo you should have used: (for debian based distros)

sudo chown -R www-data:www-data /media/data
sudo chmod -R 0750 /media/data

Only sudo can change the owner from root to www-data

Important: For consecutive commands eg mkdir you need to be user www-data eg:

sudo -u www-data bash
cd /media/data
mkdir /asdf


sudo -u www-data mkdir /media/data/asdf

There seems to be a problem in the docs, which I’m trying to fix atm.

Just a remark. … In absolutely now way I’d use a 777 permission on folders or 666 for files. Everyone knows that’s :imp:

With the RPI, there is an even bigger problem with the access rights. …

Since the SD card is probably small, we need to move everything to the attached drive. using the nextCloudPiPanel eg:

  • nc-backup-auto
  • nc-backup
  • nc-database
  • nc-datadir
  • ???

Which then contains the app and the data. … So only the /data/ directory should be writeable by www-data

The rest needs to be root … I did test this with nc-backup and it worked as root.

www-data can’t get in here!

Just wanted to say thank you for this post, that reallllly saved me a lot of time! Using the same setup with raspberry pi and mounted my drive to /var/nextcloud/data with my external, got it to work!

1 Like

After copying files I used: sudo -u www-data php /var/www/nextcloud/occ files:scan --all
I had the same problem, so i used this command again and now all permissions are set correctly.


There are already different use cases, different systems, … let’s close this issue. Some might still find an answer to their permission problems. If there are still issues, please use a new topic. We could even think about creating an howto article out of this …