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

Hi I am facing the problem “You don’t have permission to upload or create files here”. I got a new server and just copied the data into the nextcloud data folder with scp and then scanned it with occ. I googled around and all problems I saw were because people were using a different storage location, mine is the standard one. I have a different user on the same server where I don’t have any problems uploading whatsoever. I am running debian and have the rights of the “data”-folder set to 777.

Hi. Take care that the files downloaded belongs to the group www-data.

I did, I can for some reason upload to the documents folder but not to my folder I created for photos

Ok. Please can you give us what a “ls -al” of your folder returns ?

ls -al /var/www/nextcloud/data/

gives me this (I left out a lot of stuff, this is the user that I have problems with)

drwxrwxrwx  4 www-data www-data  4096 Jan 15 21:54 Tanonic

Well : you have downloaded files with scp as a Debian user and you want to access to this folder with the web interface as a Nextcloud user. There are no relations between system permissions and nextcloud permissions… The occ scan only act that news files exists.
Then to access a folder as a Nextcloud user, you have two solutions : create it or share it with another user. When the folder is created or shared, only at that moment download you files, scan it, and it will be work.

I don’t really understand, what exactly do I have to do now?

Could you please use the issue template (there is an app for it in Nextcloud) and fill in all the requested information? Furthermore we need logs to help you.

  • /var/www/nextcloud/data/nextcloud.log
  • web server error logs (under /etc/apache2/ or /etc/nginx/)

Logs usually tell what exactly went wrong.

1 Like

I solved it just by deleting the files folder, making a new one and uploading all the data from the desktop client.

Feels like this might be a common occurrence for new folks setting up NC. I am hunting for the solution to getting the permissions right after copying files to a users ‘data/user/files/photos’ directory… They are there after the files:scan, but the user does not have proper permissions within NC. The only way to make them accessible, is to copy them yet again, as that user, from one folder to another. PITA.

Is there an easier “import” process for initial setup? It’s not clear for a newbie (me).

Thanks,
Jay

I also ran into the same problem after desaster recovery and setting up a fresh docker container putting the files into the data folder from the fresh users and ran occ files:scan --all.

Importing the files was easy done, afterwards the permission issue came up.

I solved it by setting the proper permissions in the database:

DO THIS ON YOUR OWN RISK:

# Setting permissions for the folders (mimetype =2):
update oc_filecache set permissions = '31' where permissions like '17' and path like 'files/%' and mimetype like '2';
# Setting permissions for the files (all others mimetypes):
update oc_filecache set permissions = '27' where permissions like '17' and path like 'files/%';

Cheers
Roman

1 Like
# Setting permissions for the folders (mimetype =2):
update oc_filecache set permissions = '31' where permissions like '17' and path like 'files/%' and mimetype like '2';
# Setting permissions for the files (all others mimetypes):
update oc_filecache set permissions = '27' where permissions like '17' and path like 'files/%';

I just came to say thanks for this. I had the same story: New Nextcloud installation, copied the data into position and then ran occ:files -all. Most of my directories were fine, however a couple had the above permission issues.

Thanks for your help!