N8N_RESTRICT_FILE_ACCESS_TO in 2.0

I am reading this page for changes coming on v2.0 to prepare my environment

For this variable → N8N_RESTRICT_FILE_ACCESS_TO

I think it’s unset currently, but will set to something from 2.0 onward. From document, it’s saying “~/.n8n-files“. But as I understand and also what am I currently using in my docker, the director should be “~/.n8n“, is it a typo or this is for non-docker setup? What will be the actual default setting for 2.0 in docker environment?

2 Likes

so do you mean in 2.0 should use ~/.n8n-files instead of ~/.n8n?

I tried 2.0.0 rc3, but could not get write to file to work
I tried to set
N8N_RESTRICT_FILE_ACCESS_TO**=~/.n8n-files
N8N_RESTRICT_FILE_ACCESS_TO
=/.n8n-files
N8N_RESTRICT_FILE_ACCESS_TO
=**/backups

I gave up in the end.

Has anyone managed to get it working?

I’ve run into this issue today as well on Release 2.0.1, installed via npm.

We have several local filesystem scripts down various directories in /opt/scripts/
e.g. /opt/scripts/general, /opt/scripts/app1, /opt/scripts/app2 etc.

Couldn’t get any combination of N8N_RESTRICT_FILE_ACCESS_TO to work allowing access to any file in this directory or any sub directories.

I have found however that if you set it to an empty string (N8N_RESTRICT_FILE_ACCESS_TO=’’) Then it removes the restriction entirely.

Not really a solution but a workaround nonetheless.

4 Likes

I’m experiencing the same issue, specifically that the “Read/Write Files” node results in error that in cannot access folders, even when the folder is explicitly allowed using the N8N_RESTRICT_FILE_ACCESS_TO environment variable. I have seen that multiple folders can be specified using : and have tried listing folders both with and without a trailing / - same result.

I note also that the migration report still warns that the node is incompatible with v2.0 (I am on v1.123.5 currently), even if the environment variable is set as above.

The workaround identified by David_Fitton is working for me, but of course that’s not a long-term solution.

Hello, I know it’s been a few days since this discussion, but I’m using version 2.0.2 via Easypanel and was having the same problem. In fact, I even had problems with “Execute Command” and the Proxy. However, I configured the environment variables below and since then I haven’t had any more problems. “Execute Command” and “Read/Write Files from Disk” now work perfectly.

NODES_EXCLUDE=[]
N8N_PROXY_HOPS=1
N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=false
N8N_RESTRICT_FILE_ACCESS_TO=“”

2 Likes

This worked for me! Thank you so much you saved me so many hours :sob:

1 Like

Hello,
I might be late :sweat_smile: but I use “ ; “ and it now works.

N8N_RESTRICT_FILE_ACCESS_TO = /data-a;/data-s;/data-T;/data-f

1 Like

Never too late as have just upgraded yesterday with the same issue. The ole “;'“ worked a treat. Cheers for that!

I am hosting using the npm version and this doesn’t work. The event and execute command is still missing from my instance.

I had npm version too. I had the same problems, but now I can use the trigger and the execute comands. Maybe you give a try to this format: set “NODES_EXCLUDE=

My setup is a little different. I don’t use .env but I use pm2’s ecosystem file.

module.exports = {
  apps: [
    {
      name: "n8n",
      script: "n8n",           
      exec_mode: "fork",        
      interpreter: "none",    
      env: {
        PORT: 9001,
        N8N_PORT: 9001,
        N8N_HOST: "0.0.0.0",
        N8N_PROTOCOL: "https", 
        WEBHOOK_URL: "https://vu8.sbvr.us/", 
        N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true",
        N8N_RUNNERS_ENABLED: "true",
        NODE_FUNCTION_ALLOW_EXTERNAL: "*",
        NODE_FUNCTION_ALLOW_BUILTIN: "*",
        N8N_DEV_RELOAD: "true",
        EXECUTIONS_DATA_PRUNE:true,
        EXECUTIONS_DATA_MAX_AGE:14,
        EXECUTIONS_DATA_PRUNE_INTERVAL:3600,
        N8N_DIAGNOSTICS_ENABLED:false,
        NODES_EXCLUDE:"[]",
        N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES:false,
        N8N_RESTRICT_FILE_ACCESS_TO:“”
      }
    }
  ]
};

Though I had this file edited a couple of days ago but still could not get it to work.

great, this was the same problem, neither chatgpt nor Claude could give me a descend answer. After 2 days of troubleshooting I finally came across this thread, changing N8N_RESTRICT_FILE_ACCESS_TO:/home/node/.n8N-files did the trick. if you try and give 2 folder locations than it doesn’t work.

using this on macOS with docker.

now I am going to try and mount a local folder and see if I can get that to work as well

this worked for me for N8N_RESTRICT_FILE_ACCESS_TO, for this n8n release for CMD EXECUTE NODE… I also had to add NODES_EXCLUDE with blank value

From what I can tell, I guess my whole system is broken or something isn’t adding up.

Follow Up: I have migrated to docker. All my issues are resolved.