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')
If you're working in a Windows command line (PowerShell, Command Prompt), store your files in the Windows file system. For example, when storing your WSL project files: Use the Linux file system root directory: \\wsl$\Ubuntu\home\<user name>\Project.
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
Well, turns out I was being stupid and posted a stupid question.
After many hours trying to make this damn thing work, I was able to do so, by setting the ownership of the folder to my user.
Here is the shell snippet to change the ownership to the current logged in user:
$ sudo find /~~folder-path~~/ -type d -user root -exec sudo chown -R $USER: {} +~
This solved it for me
sudo find /home/ -type d -user root -exec sudo chown -R $USER: {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With