chdir(2) failed.: Permission denied on WSL 2
Published
•1 min read
Solution
1. Open Powershell as Admin
2. Use wsl command
3. Use cd /etc then Use rm wsl.conf to remove this file
4. Use sudo nano wsl.conf to re-create this file and now nano editor would open
5. Now write[user]default = root
6. Press CTRL+X then Y then press ENTER
7. Now shutdown wsl using wsl –-shutdown command
8. Now open wsl in VSCode click on open folder and select root folder. DO NOT use recent route that shows up on vscode
9. Open terminal
This error occurs when user default is not set to root in wsl.conf file