[Solved] Error when upload You don’t have permission to upload or create files here

Hello there
I am seeing the caption message when i try to upload a file with the admin account and with other account.
Here is my setup.
NC 12.0.3
Debian 9
Nginx
PHP7.0-fpm
MariaDB
RaspiberryPi 2 with external EXT4 disk mounted on startup.

Following is some config information
$CONFIG = array (
‘instanceid’ => 'instance id here ',
‘passwordsalt’ => ‘some bytes here’,
‘secret’ => ‘some bytes here’,
‘trusted_domains’ =>
array (
0 => ‘access url here’,
1 => ‘192.168.1.210’,
),
‘datadirectory’ => ‘/media/nextcloud/data’,
‘overwrite.cli.url’ => ‘access url here’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘12.0.3.3’,
‘dbname’ => ‘database name here’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘nextcloud’,
‘dbpassword’ => ‘password here’,
‘installed’ => true,
‘mail_from_address’ => ‘noreply’,
‘mail_smtpmode’ => ‘php’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_domain’ => 'some mail domain here ',
‘maintenance’ => false,
‘forcessl’ => true,
‘overwriteprotocol’ => ‘https’,
‘updater.secret’ => ‘some bytes here’,
‘theme’ => ‘’,
‘loglevel’ => 0,
);

NGINX.conf excerpt
user www-data;

NextClound.conf for NGINX
server {
listen 80;
listen 443;
listen [::]:80;
listen [::]:443;

        ssl on;
        ssl_certificate /etc/nginx/ssl/server.crt;
        ssl_certificate_key /etc/nginx/ssl/server.key;
        #ssl session_timeout 5m;
        #ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    #ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    #ssl_prefer_server_ciphers on;

    server_name server.name;

    root /var/www/html/nextcloud;

    index index.php;


    location / {
            try_files $uri $uri/ /index.php?q=$request_uri;
               }

    location ~ \.php$ {
            try_files $uri $uri/ /index.html;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
                    }

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            deny all;
                }
#       location ~/\.ht {
#               deny all;
#       }

}

/etc/fstab mount of external disk
PARTUUID=a97d6249-01 /media/nextcloud ext4 defaults, noexec 0 2

ls -al of NC data folder
pi@raspberrypi:~ $ sudo ls /media/nextcloud/data -al
total 9552
drwxrwx— 6 www-data www-data 4096 Nov 25 18:39 .
drwxr-xr-x 4 root root 4096 Nov 27 10:04 …
drwxrwx— 10 www-data www-data 4096 Nov 25 18:39 appdata_ocyrf1pyoko8
drwxrwx— 2 www-data www-data 4096 Nov 27 09:44 files_external
-rwxrwx— 1 www-data www-data 324 Nov 25 18:39 .htaccess
-rwxrwx— 1 www-data www-data 0 Nov 25 18:39 index.html
-rw-r----- 1 www-data www-data 9741187 Nov 28 11:52 nextcloud.log
-rwxrwx— 1 www-data www-data 0 Nov 25 18:39 .ocdata
drwxrwx— 4 www-data www-data 4096 Nov 25 18:39 user1
drwxrwx— 4 www-data www-data 4096 Nov 25 18:39 webadmin

When i installed NC initially the data folder was i the webserver www folder then i moved it following commands
NC in maintenance mode
cp the data fiolder to new location
chown and chmod the new location
change the database storage table
NC out of maintenance mode
Rescan of data folder.

I am out of clues guys so any help is appreciated. this is my first install of NC so may be I miss something. I am tech person, but not too much into linux, although I understand more or less what I am doing.

Thanks a lot in advance.
Christo

have you put interest into this thread, already? --> Is there a safe and reliable way to move data directory out of web root?

i’m sure this will be of great help in your case. esp, answer #4

good luck

Hello JimmyKater

I have followed the Solution #1 from this thread link

1 Like

@JimmyKater
Reading the other thread I do suspect that this
When moving the data folder to an external drive, make sure you used the correct user to mount the drive…
(Even format as the user depending on the filesystem.)

could be my problem as I formated the drive on another PC.

I will try formating again. Thanks for your time.

1 Like

Hmm if your system generally supports the file system, chown the whole drive or nextcloud data subfolder to webserver user should be possible?

I suspect that my problem is in nginx configuration and/or php7.0-fpm. yesterday i removed completely the NC installation and reinstalled. Same result. Continuing to investigate.

As I said, the location of your Nextcloud data folder has do be writeable/better owned by webserver user. This has nothing todo with configs and can’t be solved by reinstallation. Try chown -R www-data:www-data /mnt/yourdrive/ncdata after creating that folder.

Hi @MichaIng
i think i did this the right way. here is ls of the mount point of the drive and data folder as well.

pi@raspberrypi:~ $ sudo ls /media/nextcloud/ -al
total 28
drwxr-x— 4 www-data www-data 4096 Nov 28 22:11 .
drwxr-xr-x 4 root root 4096 Nov 25 18:37 …
drwxr-x— 6 www-data www-data 4096 Nov 28 22:51 data
drwxr-x— 2 www-data www-data 16384 Nov 28 13:30 lost+found
pi@raspberrypi:~ $ sudo ls /media/nextcloud/data -al
total 100
drwxr-x— 6 www-data www-data 4096 Nov 28 22:51 .
drwxr-x— 4 www-data www-data 4096 Nov 28 22:11 …
drwxr-x— 9 www-data www-data 4096 Nov 28 22:52 appdata_ocmvdh5r7t5f
drwxr-xr-x 2 www-data www-data 4096 Nov 28 22:52 files_external
-rwxr-x— 1 www-data www-data 324 Nov 28 22:52 .htaccess
-rwxr-x— 1 www-data www-data 0 Nov 28 22:52 index.html
-rw-r----- 1 www-data www-data 60053 Nov 29 10:52 nextcloud.log
-rwxr-x— 1 www-data www-data 0 Nov 28 22:52 .ocdata
-rw-r–r-- 1 www-data www-data 12232 Nov 28 22:52 updater.log
drwxr-xr-x 4 www-data www-data 4096 Nov 28 22:52 updater-ocmvdh5r7t5f
drwxr-x— 4 www-data www-data 4096 Nov 29 09:19 webadmin

Hello
I tryed also to change the group with chgrp, chown again and chmod 0770 again with full root privileges and no luck.
Redid the nginx configuration as well.
Still can’t upload.

If someone is installing NC with NGINX on ext usb drive, or moved data directory following two links is all you need to know.

Nginx Configuration — Nextcloud 12 Server Administration Manual 12 documentation
HowTo: Change / Move data directory after installation

this is solved for real now :slight_smile:

1 Like