VScode unable to save files inside my WSL2 home folder

Lucas Pacheco picture Lucas Pacheco · May 23, 2020 · Viewed 8.8k times · Source

I'm trying to make WSL2 work for my web projects development and this is driving me crazy!

Basically, i have two options. 1. Save my project files into c drive and access those with WSL (which makes the responses extremelly slow) 2. save my project files into /home/ which makes the project run super smooth, but i'm unable to edit those files with VSCode.

The error that is what follows:

Failed to save 'DefaultSeeder.php': Unable to write file 'vscode-remote://wsl+ubuntu-20.04/home/lucas/Projetos/API/src/database/seeds/DefaultSeeder.php' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/lucas/Projetos/API/src/database/seeds/DefaultSeeder.php')

Answer

ansona picture ansona · Dec 14, 2020

Here is another command to provide your user with sufficient permissions to write to files:

sudo chown -R myuser /path/to/folder

From https://github.com/microsoft/vscode-remote-release/issues/1008