VS Code: NoPermissions (FileSystemError): Error: EACCES: permission denied

Viewed 31056

I'm trying to save a file called app.js on a folder called js.

Vs Code pop up this:

Failed to save 'app.js': Unable to write file 'vscode-remote://wsl+ubuntu-18.04/js/app.js' (NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/js')

I tried:

sudo chown -R user /mnt/c/Users/myUser/Documents/myFolder/proyectFolder

but I still can't save this file.

7 Answers

Try this, fixed it for me

sudo chown -R username path 

Example:

sudo chown -R emanuel /home/emanuel/test/

TLDR;

If you're using a docker container, avoid making files from within the container because the owner and group permissions may cause problems with your editor (in my case VS Code)


I was running docker container for a Django project from Windows Terminal and using VS Code to edit my code.

It is a Linux file (since everything in Linux is a file) permission problem that arises because the files don't have proper user and/or group permissions. So VS Code tries to tell us that.

The problem I found only happened when I created files from within my docker container.

  • I would run docker exec ... bash
  • make new files using touch /path/to/file from the container bash
  • then try to edit those files on VS Code (say urls.py) only to get the scary permissions error preventing the file from saving.

I suspect that making files from within the container embellishes those files with different owner and group settings than your system would default to if you just ran the commands locally (not in the container).

Changing the file permissions with chown -hR and chgrp -hR would do the trick but to avoid the error altogether I stopped making files from within the container.

In the SSH terminal:

Recommended :

sudo chmod -R 777 folder_name_where_your_file_exists 

or

sudo chmod -R 755 folder_name_where_your_file_exists 

this works for me

sudo chown -R $USER:$USER /home/

Try activating polling:

This worked for me during I tried using wsl.

enter image description here

The below is for individual file:

sudo chown yourUserNAme filename

For an entire directory it will be (when you write ls to terminal, you should see your directory to execute this command):

sudo chown yourUserNAme dirName

For recursive (i.e files and folders inside a folder):

sudo chown -R yourUserNAme dirName

Note: yourUserNAme is, if you do pwd under any Documents, you will see the path: /home/jhon/Documents. Here user is jhon.

It is a Linux user permissions problem. you should use the command:

sudo chown -R $USER:$USER.
Related