Nextcloudpi external usb permissions

Hello everyone,

I have been trying to mount an USB stick on my nextcloudpi (raspberry pi 4).


  • raspberry pi 4 running nextcloud (nextcloudpi)
  • usb stick inserted into raspberry pi
  • nc-automount is turned on
  • using the éxternal storage app’, added my usb stick as a local external storage (Local -> path /media/USBdrivelabel) user access field left blank (everyone can access).
  • accessing nextcloud from web-interface on LAN-connected pc.
  • folder is visible under “files” tab

When trying to access the folder, it displays: “you do not have permission to upload or create files here”. Same goes for syncing with a desktop/android client.

I need to set permissions somehow. But so far i could not find a solution that works anywhere. Mind you: I can only access the nextcloudpi through the web-interface, not directly. Thus i do not know how to issue commands (which some proposed solutions point to).

Where do i start?

You will need console access to the Pi.

First thing to check is make sure the www-data user has full access to the flash drive.

you should have access to your webgui of ncp via - (it asks for your webgui-user, usually that’s ncp) and your password

then you could use the menu to the left side to use the correct permissions-button.
as well as many others

I have gone through the web-ui many times.

Can’t find any such setting. the only thing close is “fix permissions” and that is not what i need.

To be clear, i do not want my data directory on the usb, i want my data directory on the pi, and the usb to serve as additional external storage.

Any way to gain console access remotely?

That sounds like a job for SSH.

I have managed to get an SSH connection. Still walking into the same roadblock that i can’t find anywhere how to give which user permission to what folder.

Assuming it has to be done using the chmod command, but because i am an absolute noob i get a little stuck here.

[/edit] a sudo chmod a+w /media/usblabel did not provide read/write/execute permissions from within nextcloud

[/edit 2] Using ls -l, permissions ar currently set as:
drwxrwxrwx for “usblabel”
lrwxrwxrwx for “usb drive --> /media/usblabel”

What it comes down to (assuming this is the issue — it may not be) is the user that your web server runs as (probably www-data) needs to have read/write/exec permission to the folder.

What is the file system on the flash drive? You can check by typing mount.

1 Like

Right. but… how? I formatted the drive as Btrfs.
As far as i understood, using chmod a+… will change permissions for all users, and should do so as well for www-data. What part of that is incorrect? (healp)

From what you posted above, it sounds like the filesystem permissions should work.

Next question: Did you assign yourself write access to the external storage in Nextcloud?

I added the external storage using the “external storages” app. It does not have a button or option for write-permissions, but it does have an option for “read-only”, which is unchecked.

awww. ok. so i bet your usb-stick should be owned by user www-data:www-data

my bad, sorry. i only try to remember it. old brain couldn’t remeber it correctly :frowning:

1 Like

I can’t find if it is in fact owned by www-date:www-data, or how to change ownership for that particular user.

at the risk of repeating myself, i still think that should not matter when using the chmod a+… command.

I really appreciate you guys taking the time.

an ls -la should show you by whom it’s owned.

It is owned by root.

[/edit] using the chwon command to change ownership to www-data:www-data returns:
chown: changing ownership of ‘/media/usblabel’: Operation not permitted
[/edit2] sudo chown worked (facepalm), but it did not fis the issue.
[/edit3] I tried to change ownership of “USBdrive -> /media/usb label” instead of “/media/usb label” which returns the following: -bash: /media/usb label: Is a directory

I’d try creating a folder and give ownership to www-data

sudo mkdir /media/usblabel/ncdata
sudo chown www-data /media/usblabel/ncdata

Try that in external storage app.

I did that, no game. In both the user and admin accounts, it still dispolays the same message.
the owner is successfully changed for /media/usblabel/folderlabel