Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2815

WSL2: New user can't write to file through VS Code

$
0
0

I have the Ubuntu app installed with WSL2 whereas I now want to add a new user with essentially the same permissions as the first user created.

I used

sudo adduser work

and then added the new user work to the sudo group

sudo usermod -aG sudo work

I realised that running Visual Studio Code with code ~/newfile doesn't work as the PATH variable doesn't transfer to new users. Thereby I added my path in ~/.profile

PATH=$PATH:/mnt/c/Users/<username>/AppData/Local/Programs/Microsoft\ VS\ Code/bin

and restarted Ubuntu. The code ~/newfile command works somewhat as it opens up in VS Code but when saving I get the error:

Failed to save 'newfile': Unable to write file '\\wsl$\Ubuntu\home\work\newfile' (NoPermissions (FileSystemError): Error: EPERM: operation not permitted, open '\\wsl$\Ubuntu\home\work\newfile')

Also, I get continually get messages such as:

[main 2021-09-14T14:11:56.537Z] update#setState idle[main 2021-09-14T14:12:26.539Z] update#setState checking for updates[main 2021-09-14T14:12:26.636Z] update#setState idle[20656:0914/161357.347:ERROR:gpu_init.cc(440)] Passthrough is not supported, GL is disabled

Which by this question also indicates, whereas answers tell that code.cmd should be used instead. But if I use it, it does not work properly:

/mnt/c/Users/<username>/AppData/Local/Programs/Microsoft VS Code/bin/code.cmd: line 1: @echo: command not found/mnt/c/Users/<username>/AppData/Local/Programs/Microsoft VS Code/bin/code.cmd: line 2: $'setlocal\r': command not found/mnt/c/Users/<username>/AppData/Local/Programs/Microsoft VS Code/bin/code.cmd: line 5: fg: no job control/mnt/c/Users/<username>/AppData/Local/Programs/Microsoft VS Code/bin/code.cmd: line 6: endlocal: command not found

Viewing all articles
Browse latest Browse all 2815


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>