New Installation. Can not upload any file

i setup a new server from scratch using Reinernippes Guide

When i try to upload any file via the web gui i just get:

I checked the log in /var/www/nextcloud/data/nextcloud.log

and found only this:

{"reqId":"LaVxbREowoS9xbgcUm6","level":3,"time":"2021-04-17T23:00:21+00:00","remoteAddr":"","us> {"reqId":"LaVxbREowoS9xbgcUm6","level":3,"time":"2021-04-17T23:00:21+00:00","remoteAddr":"","us>

The issue happens under the main admin account, and also a standard user i created.
Any tips?
Thanks a lot


Nextcloud 21.01

Operating System: Linux 5.4.0-72-generic x86_64
CPU: AMD EPYC 7282 16-Core Processor (4 cores)
Memory: 7.77 GB

Version: 8.0.3

Memory Limit: 512 MB

Max Execution Time: 3600

Upload max size: 10 GB

Type: pgsql

Version: PostgreSQL 13.2 (Ubuntu 13.2-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit

Size: 13 MB

@axo all permissions is right ? www-data user for apache and nginx need to have Read Write and execute ( RWX) access on files and folder. To see this done this line in your nextcloud folder : ls -l

Here are a few screenshots

Search for www-data:

i do not have a www-data directory.
Did the installation script fail?
I have used the standard installation playbook i mentioned in the OP.
I have used the docker playbook on another server previously and it worked without issues.

On this one, i had a few issues:
the text recognition (tesseract-ocr) complained a bit and had to disable it in the second attempt i run the script.

And i enabled encryption of the data directory in the nextcloud admin panel right away, just in case that may be affecting the data directory permissions.
I am using encryption on my other server and did not have this problem,.

What else can i check?


I just chmod 777 that data folder in nextcloud and still the same… did i mess up ?

@axo oh sorry, www-data isn’t a directory but a user of apache2 or nginx on a basic installation but yours seem to be nginx user so don’t change it.
The encryption doesn’t affect the permissions of files and directory.
Can you check your datadirectory in config.php ? ( /var/www/nextcloud/config/config.php)
It is /var/nc-data ? if yes check the permissions of this folder
In your case, nc-data must be owned by nginx and this user need RWX (Read Write Execute) permissions on the folder.

Selinux is often trouble for things like this.
Quick test; run (as root) setenforce 0 and try again. If it works, then your web server is being blocked from writing by selinux.

@Mageunic Thank you for taking the time to assist me with this little glitch.

I found the /var/nc-data folder and it

. i changed it to 770 and restarted nginx but i still can not upload any files.

@axo this is strange…
try to set www-data:nginx for user and group of the folder
have you try what @Larry_Boyd advises you ??

And rather than guessing at the right user and group, set the permissions to 777, then write to it and observe the permissions with which new files are created and replicate that to the parent.

sorry i missed this one…

Ok i got this:

# setenforce 0

setenforce: SELinux is disabled

What does it mean?

It means that you have disabled selinux, which is, unfortunately, a very common bad practice. Selinux is not known for being easy to configure, so a lot of people, rather than taking the time to understand it, just disable it and call it a day. Its a shame, because it is a very strong security platform when care is taken to configure it correctly.

Anyhow, try setting the directory permission to 777 in order to make it world writable. After you have written something to it, you can look at the owner and group assigned to it and replicate that to the parent and reset to 700 or 770.

Ok look.

  1. i first changed to 777 and tested uploading a file, no luck.
  2. then changed the owner and restarted nginx (im not sure, is this is necessary?)

then i see the permissions revert to 770.

About the selinux… i have no idea what it is, i just used the playbook as is so it must be disabled there i guess?

I just tested this setenforce 0 command in my other nextcloud working server and it also shows SELinux is disabled.
I have an issue where my cellphone automatic uploads can not write some stuff in the server, but everything else, like normal file uploads always worked. I used the same playbooks but with the docker option instead… i would assume ReinerNippes scripts are identical except for the standard vs docker option.

Ok! i found the actual log needed. i saw it in the nc-data folder… so i believe the issue is nextcloud can not find the encryption module, hence why it can not write the files to the server?

{“reqId”:“hIvybAp79nAe0ZB5qau5”,“level”:2,“time”:“2021-04-18T19:34:36+00:00”,“remoteAddr”:“”,“user”:“admin”,“app”:“core”,“method”:“PUT”,“url”:"/remote.php/webdav/00100lrPORTRAIT_00100_BURST20200830184816321_COVER.jpg",“message”:{“Exception”:“OC\Encryption\Exceptions\ModuleDoesNotExistsException”,“Message”:“No default encryption module defined”,“Code”:0,“Trace”:[{“file”:"/var/www/nextcloud/lib/private/Encryption/Manager.php",“line”:190,“function”:“getDefaultEncryptionModule”,“class”:“OC\Encryption\Manager”,“type”:"->",“args”:[]},{“file”:"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php",“line”:430,“function”:“getEncryptionModule”,“class”:“OC\Encryption\Manager”,“type”:"->",“args”:[""]},

Problem SOLVED!!!

Ok after reading the encryption section in the NC manual, i found you need to enable the little encryption module via the APPs, besides the encryption checkbox in the settings…
No problems.
Thanks a lot guys

1 Like