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

Steps to reproduce

  1. Attached an external usb drive and mounted it
  2. Enabled it from the admin storage console.
  3. Go to files. I see the external drive but I get the error “You don’t have permission to upload or create files here”

Expected behaviour

Tell us what should happen

Actual behaviour

Tell us what happens instead

Server configuration

Operating system:
Raspberry Pi Raspbian

Web server:
Apache 2

Database:
Maria

PHP version:
7.3

ownCloud version: (see ownCloud admin page)

Updated from an older ownCloud or fresh install:

Where did you install ownCloud from:

Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php:

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Are you using external storage, if yes which one: local/smb/sftp/…

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/…

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...

Good Morning!

The user that is running the web server must have r/w access rights on the mounted disk.

Hello Alfred,

Thank you again for your continued support and help. Here is some weird behavior:

  • Yes, to your point that is done by running the “sudo chown” command

    • “sudo chown -R www-data:www-data /media/data/1tb_drive”
    • This was completed successfully but still no luck
  • On a whim I tried to upload a file to the directory and it uploaded! While it still shows do not have permissions to create files etc. But this is not the expected behavior as I still cannot create any subdirectories. Only just blindly upload files, but this is not what we want.

thanks
Raj

That is not enough for external storage. I has to be mounted accordingly. See the link in my post referred above.

Worked. Here is what I did:

OS Version

System - Raspberry Pi 4
OS - Stock Raspbian linux

Install owncloud

Configure OwnCloud for External Storage

  • Edit /var/www/owncloud/config/config/php (well at least thats how its on my rpi now)

  • ‘files_external_allow_create_new_local’ => true,

  • Preparing External Drives (will depend on case by case)

    • I was working on an external NVME drive 1TB
    • Install the exfat utils (had formatted this drive as an exfat filesystem on a mac)
    • sudo apt-get update ; sudo apt-get upgrade
    • Plugged it NVME drive the USB 3.0 port of RPi 4
    • RPi should recognize the drive
  • Run “sudo fdisk -l”

    • Will take a min but you should see two drives
    • /etc/sda1
    • /etc/sda2 (980 Gig available)
    • This might take a few tries though. I had quite a bit of trouble after soft reboots. Needed to physically power-cycle.
  • mkdir a new dir in /media/data

    • run command “sudo mkdir /media/data/nvme1tb-owncloud”
  • Find the ID for www-data

    • run command “sudo id -a www-data”
    • in my case both uid and gid was 33
  • Mount the drive with the right permissions

    • run command -
      “sudo mount -t exfat -o umask=0022,gid33,uid=33 /dev/sda2 /media/data/nvme1tb-owncloud”
  • Also give additional ownership permissions

    • Run command
      “sudo chown -R www-data:www-data /media/data/nvme1tb-drive”
  • Go to owncloud console and add the drive.

    • Enable external drive
    • Should be able to see Local drive in drop down when adding the drive type.
2 Likes