Details about the Linux host server running the Nextcloud AIO container, including how Nextcloud AIO accesses file storage, etc. would be helpful.
How is Syncthing installed? Also in a container?
It all depends on how the storage is set up for Nextcloud AIO. When working with containers, there’s usually a pool of shared storage. You’ll have to configure permissions on the storage so that both Nextcloud AIO and Syncthing can access it.
The host is an Ubuntu Server 22.04 LTS. Both are installed using Docker containers.
They both have a path to the same host folder (/mnt/st/:ncdata for nextcloud and /mnt/st/:data1 for syncthing)
How do I give the syncthing permission to also access the same folder on the host? I tried using chmod, but I am still learning how to use Linux so I must’ve done it wrong.
There’s more than one way to set things up, but they all boil down to two approaches:
Inside a container is a subset of a typical Linux system. Not enough to be a true virtual machine, but because a container is effectively a mini Linux system, there are users and groups (along with the usual file and directory permissions). Match the UID/GID (User ID / Group ID) inside the container with the UID/GID for the storage provided by the host.
Make the storage readable/writable by all users.
The second option is pretty blunt, and potentially a security issue, but can be a viable option for a home setup on a private network.
The first option is better but requires more work.
The nuclear option…
If you choose to simply make the storage readable/writable by everyone, the following command will do it:
chmod -R a+rwx /mnt/st
-R is short for --recursive. All subdirectories will be changed.
a+rwx means make it “all” readable (r), writable (w) and executable (x) for user, group and others (anyone who isn’t the owner or belongs to the group).
After using this option, please make sure to apply the correct permissions to the directories that you want to use in Nextcloud. E.g. sudo chown -R 33:0 /mnt/your-drive-mountpoint and sudo chmod -R 750 /mnt/your-drive-mountpoint should make it work on Linux when you have used --env NEXTCLOUD_MOUNT="/mnt/". On Windows you could do this e.g. with docker exec -it nextcloud-aio-nextcloud chown -R 33:0 /run/desktop/mnt/host/d/your-folder/ and docker exec -it nextcloud-aio-nextcloud chmod -R 750 /run/desktop/mnt/host/d/your-folder/.
So the Nextcloud AIO container is using a UID of 33 and GID of 0:
chown -R 33:0 /mnt/st
If you’re using the official Syncthing container, set PUID=33 and PGID=0 so that Syncthing will run as user:group 33:0 inside the container.
It makes sense to run Nextcloud in a container because it requires several components including a database server, web server, etc.
But I think running Syncthing in a container is overkill in all but specific use cases. Syncthing is a self-contained binary with minimal system dependencies so it’s less complicated to run it as-is on the host system.