Reputation: 701
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.
Upvotes: 60
Views: 160980
Reputation: 213
If you created some file using Docker with root account like docker exec ...
. You won't be able to edit that outside Docker, because of permission issue.
$ ls -l
-rwxr-xr-x 1 1000 1000 668 Oct 22 04:17 old_file
drwxr-xr-x 3 root root 4096 Oct 22 04:53 new_file_created_inside_docker
In this case, you can see the new_file is owned by root.
To fix that
chown -R 1000:1000 new_file_created_inside_docker/
Upvotes: 0
Reputation: 2029
Try this, fixed it for me
sudo chown -R username path
Example:
sudo chown -R emanuel /home/emanuel/test/
Upvotes: 202
Reputation: 1599
Just go to Settings, then search for UNC. Uncheck "Security: Restrict UNCAccess" This works for me.
Upvotes: 0
Reputation: 11
It is a Linux user permissions problem. you should use the command:
sudo chown -R $USER:$USER.
Upvotes: 0
Reputation: 353
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
Upvotes: 18
Reputation: 527
Install the extension Save as Root in Remote SSH in VS code.
Upvotes: 3
Reputation: 63
Run VS Code as administrator and it will fix the problem. https://answers.microsoft.com/en-us/windows/forum/all/error-in-vs-code-destination-directory-and-says/e70dc626-6b12-4791-a960-8b704e57098d
Upvotes: 3
Reputation: 131
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.
Upvotes: 1
Reputation: 171
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.
docker exec ... bash
touch /path/to/file
from the container bashI 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.
Upvotes: 6
Reputation: 189
Try activating polling:
This worked for me during I tried using wsl.
Upvotes: 2