Nextcloud -- Mass Data Migration (file permissions problem)

  • I'm attempting to mass migrate ~3.5TB of data, locally on the server, into my Nextcloud data folder, but I have encountered permission problems.


    I'm running Debian Buster (10) with KDE desktop environment and Open Media Vault 5 installed to handle most server tasks. I'm using Portainer to setup & manage all my docker images, as I am new to Linux & Docker. I pulled linuxserver/nextcloud and linuxserver/mariadb, mostly following @TechnoDadLife Nextcloud tutorial, with adaptation for OMV 5 now using Portainer to manage Docker.


    I tried to adapt a Mass Data Migrate tutorial, but got confused, and ended up launching Dolphin file explorer as root (pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin) and copy my source directory into <my Nexcloud data directory>/<USER>/files directory via GUI.


    I then installed the OCC Web app and ran: files:scan --all
    ...I tried to use the OCC tool via command line, but I was unable to figure out how to do that inside a docker image. Now, when I try to sync files on Windows 10 using the Nextcloud official client, I get errors saying: Not allowed because you don't have permission to add files in that folder. I tried creating a simple .txt via the Nextcloud web interface, so it will let me add. However, it will not let me delete the file I just created.


    I bashed into my Nextcloud container: docker exec -it Nextcloud bash
    Then I went to the data directory: cd /data
    Then I listed out permissions


    Help! ?(


    P.S. My goal is to have both laptop, (and other mobile devices) sync to one of two profiles, and both profiles have access to each other's data. I would ideally like a Samba share option too, but it looks like I can either use Nextcloud (w/client or web), or Samba, but not both. Perhaps I could use external storage in Nextcloud, but I don't know the pro/cons and how that could have security &/or compatibility problems. Still new to Linux, Docker, etc and just trying to find the best Home NAS solution that involves syncing data in background with little user tech expertise, as well as offering a little cloud storage management.


    Cross-posted:

  • No, I'm unable to access the Nextcloud data folder from the user I specified via GUID & PGID (outside the docker instance), so I assumed that I would have to make all these changes from within the Nextcloud instance, to keep everything working correctly. However, because I prefer a GUI, I did run Dolphin as root to bulk move data.


    Side-note, this does illustrate how I don't quite grasp Linux permissions. I'm not sure what I should run as root, what I shouldn't. If I should create a non-root admin account with sudo privileges, and keep my user account separate from the admin account with sudo privileges. However, my first goal was to get nextcloud and some other docker images up and running, then determine how to harden security later, as I've kept everything in my local network, thus far.

  • You are doing these changes outside of the container cause the files are inside the mounted volumes. To run the occ commands you have to bash into the container (or use the occ web app). Have you specified a certain user which runs your docker containers (no need for sudo privileges).
    To chown the files you should use the root user. Do you know how it works?

  • To answer your last question, no, I do not understand how a lot of this works, although I've tried to understand. I do not know which user is running the docker containers. However, now Nextcloud seems to be behaving itself. Maybe I needed to chmod and chown and then stop and restart container? Maybe I needed to occ files:scan --all after I did the chmod and chown, then restart the docker instance?

  • The user who runs the docker container is specified by the pgid and puid (which you get when you enter id user in cli). This user needs the rights the modify the folders. This is usually not the case when you copy in external files as root.
    A restart of the container and occ scan of the files after doing the chown seen reasonable.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!