Good morning, I'm a beginner with n8n, and I'm having trouble reading/writing files from disk.
I have a workflow that works fine up to the HTTP request, but when I try to write PDF files to disk, I get an error saying I can't write to disk.
I'm using:
Docker
Windows 11 - WSL
I've attached my docker-compose.yml file; it might be a bit messy. I've tried every solution I found online.
The folder where I want to save the files is c:\n8n_files\OT\01_Entrada. In n8n, it shows up with the "Mount" message.
If you can help me, I'd be very grateful.
But it still doesn’t work; I’ve tried. It returns the same error.
After changing the docker-compose.yml file and using docker compose down and docker compose up -d, I still can’t write to the file.
this error is usually either n8n blocking the path or the container user not having write permission to the Windows-mounted folder. In your docker-compose.yml you currently have N8N_RESTRICT_FILE_ACCESS_TO: /n8n_files/ but your actual mount is C:/n8n_files:/home/node/files:rw, so n8n can end up refusing writes because the allowed path doesn’t match where you’re writing.
Set N8N_RESTRICT_FILE_ACCESS_TO=/home/node/files (and remove the /n8n_files one), then fully restart with docker compose down and docker compose up -d. After that, verify the container can actually write by executiing in and running a quick write test like touch /home/node/files/OT/01_Entrada/test.txt (also check perms with ls -ld on those folders).
if the touch fails, it’s a Windows/WSL mount permissions issue (the container runs as the node user and sometimes the mount behaves effectively read-only), in which case a quick fix is to temporarily run the container as root (user: “0:0”), chown -R node:node /home/node/files, then switch back and restart.
One small extra thing: your filenames include spaces (e.g., 5058-horas Categorias.pdf) which usually works but can still cause edge-case issues, so if everything else is fixed and it still fails, try replacing spaces with underscores in the filename expression.
If you paste the output of that touch test (and the ls -ld lines), I can tell you exactly whether it’s the n8n restriction or mount permissions causing it.
The path fix is right but WSL + Docker volume mounts to Windows paths are notoriously finicky with permissions. Try adding user: "root" to your compose file like suggested, and if that still doesn’t work try creating the folder structure inside WSL itself (like /mnt/c/n8n_files/OT/01_Entrada) and make sure the folder exists and is writable with chmod 777 on it before mounting. Windows folder permissions don’t always translate cleanly through the WSL layer.
Looking at the screenshots, the folder structure exists inside the container at /home/node/files/OT/01_Entrada/ which is good, but the write still fails even with the path fix. Since you’ve already tried the N8N_RESTRICT_FILE_ACCESS_TO change and it’s still blocking, try running docker exec -it n8nwahalocal-n8n-1 sh -c "touch /home/node/files/OT/01_Entrada/test.txt" from your terminal to see if the container can actually write there at all — if that fails too then it’s definitely a Windows/WSL mount permission issue and you’ll need the user: "root" line or to fix the folder permissions on the Windows side.
Good morning. Thank you for your responses. I couldn’t reply over the weekend because I was busy with construction work at my house. Here’s a screenshot of the test you mentioned. The test worked to generate the “test.txt” file. I had already run the test, and the “test.txt” file was from a previous test.
Regarding folder access, User, System, and admin have full control access. I’m still trying things out.
PrintScreen:
Interesting, so the touch command worked from inside the container which means the mount permissions are actually fine. The issue is probably that n8n runs as the node user by default but your exec command ran as root. Try adding user: "root" to your docker-compose like was suggested earlier, or alternatively run docker exec -it n8nwahalocal-n8n-1 sh -c "chown -R node:node /home/node/files" to give the node user ownership of that directory.