microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.42k stars 29.34k forks source link

VS does not assign PROPER permissions to folders... #211594

Closed cryptosoaring closed 6 months ago

cryptosoaring commented 6 months ago

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

  1. When I attempt to open a folder from Ubuntu terminal, the folder will open in VS code. The WSL shows in green at the lower left corner but I cannot create a file or folder in my project...........

Unable to write file 'vscode-remote://wsl+ubuntu-22.04/home/cryptosoaring/trading_bot/.env' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/cryptosoaring/trading_bot/.env')

I used to have it working fine. I could create files and folders in VS code. I had to uninstall Ubuntu because I accidentally deleted some files in the parent folder. So I reinstalled Ubuntu. I have seen that I'm not the first person to have this problem. I want to know the ROOT CAUSE. I believe it is an installation issue. It worked before....Why can't I create folders and files now?

aeschli commented 6 months ago

We are using the default user when starting WSL. In your case this seems to be a user called cryptosoaring. VS Code doe not do anything with permissions.

Can you test that this user has write permission in the trading_bot folder? Maybe you checked out that repo with a different or admin user? Run wsl in a window command prompt and then run ls -al ~/trading_bot to see the permissions.

cryptosoaring commented 6 months ago

I start Ubuntu by clicking on the Icon in my windows start menu. I didn't not get this above from typing cmd. cryptosoaring is the username I created when I installed Ubuntu. It asks for a username and pw.

So before when I dragged a folder from my windows downloads area into Ubuntu I didn't have any issue with permissions on the folder. Why does trading_bot say root? It is not the root. If anything cryptosoaring would be the root. Isn't that right? What should I do?

Windows Subsystem for Linux is now available in the Microsoft Store! You can upgrade by running 'wsl.exe --update' or by visiting https://aka.ms/wslstorepage Installing WSL from the Microsoft Store will give you the latest WSL updates, faster. For more information please visit https://aka.ms/wslstoreinfo

Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)

This message is shown once a day. To disable it please create the /home/cryptosoaring/.hushlogin file. @.:~$ @.:~$ ls hardhat-tutorial trading_bot trading_bot.older @.:~$ cd trading_bot @.:~/trading_bot$ code @.:~/trading_bot$ cd .. @.:~$ ls -al trading_bot total 352 drwxr-xr-x 6 root root 4096 Apr 28 21:22 . drwxr-x--- 9 cryptosoaring cryptosoaring 4096 Apr 28 23:02 .. -rw-r--r-- 1 root root 218 Jan 10 07:45 .env.example -rw-r--r-- 1 root root 100 Jan 10 07:45 .gitignore -rw-r--r-- 1 root root 9872 Jan 10 07:45 README.md -rw-r--r-- 1 root root 9998 Jan 10 07:45 bot.js -rw-r--r-- 1 root root 526 Jan 10 07:45 config.json drwxr-xr-x 2 root root 4096 Apr 28 21:22 contracts -rw-r--r-- 1 root root 370 Jan 10 07:45 hardhat.config.js drwxr-xr-x 2 root root 4096 Apr 28 21:22 helpers -rw-r--r-- 1 root root 288618 Jan 10 07:45 package-lock.json -rw-r--r-- 1 root root 477 Jan 10 07:45 package.json drwxr-xr-x 2 root root 4096 Apr 28 21:22 scripts drwxr-xr-x 2 root root 4096 Apr 28 21:22 test @.:~$ ls -al total 56 drwxr-x--- 9 cryptosoaring cryptosoaring 4096 Apr 28 23:02 . drwxr-xr-x 3 root root 4096 Apr 28 18:59 .. -rw------- 1 cryptosoaring cryptosoaring 1316 Apr 29 10:45 .bash_history -rw-r--r-- 1 cryptosoaring cryptosoaring 220 Apr 28 18:59 .bash_logout -rw-r--r-- 1 cryptosoaring cryptosoaring 3968 Apr 28 19:57 .bashrc drwxr-xr-x 3 cryptosoaring cryptosoaring 4096 Apr 28 22:55 .cache -rw-r--r-- 1 cryptosoaring cryptosoaring 0 Apr 29 10:28 .motd_shown drwxr-xr-x 5 cryptosoaring cryptosoaring 4096 Apr 28 23:02 .npm drwxr-xr-x 8 cryptosoaring cryptosoaring 4096 Apr 28 19:59 .nvm -rw-r--r-- 1 cryptosoaring cryptosoaring 807 Apr 28 18:59 .profile -rw-r--r-- 1 cryptosoaring cryptosoaring 0 Apr 28 19:04 .sudo_as_admin_successful drwxr-xr-x 5 cryptosoaring cryptosoaring 4096 Apr 28 21:24 .vscode-server -rw-r--r-- 1 cryptosoaring cryptosoaring 183 Apr 28 20:10 .wget-hsts drwxr-xr-x 5 cryptosoaring cryptosoaring 4096 Apr 28 22:55 hardhat-tutorial drwxr-xr-x 6 root root 4096 Apr 28 21:22 trading_bot drwxr-xr-x 6 cryptosoaring cryptosoaring 4096 Apr 28 23:01 trading_bot.older @.:~$

On Mon, Apr 29, 2024 at 7:38 AM Martin Aeschlimann @.***> wrote:

We are using the default user when starting WSL. In your case this seems to be a user called cryptosoaring.

Can you test that this user has write permission in the trading_bot folder? Maybe you checked out that repo with a different or admin user? Run wsl in a window command prompt and then run ls -al trading_bot to see the permissions.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/211594#issuecomment-2082491968, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHAXR3XVN2EWXOUHK22LHSDY7YWMBAVCNFSM6AAAAABG5QGQOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBSGQ4TCOJWHA . You are receiving this because you authored the thread.Message ID: @.***>

cryptosoaring commented 6 months ago

I should say that I installed and uninstalled Ubuntu a few times. One of those times it created root as the username. But I uninstalled this and reinstalled it again making cryptosoaring as the username.

I have been googling this. I ran this: sudo chmod -R 775 /home/cryptosoaring/ and I now have write permissions on cryptosoaring.

cryptosoaring@DESKTOP-UKV35UH:~/trading_bot$ ls -l total 336 -rwxrwxr-x 1 cryptosoaring cryptosoaring 9872 Jan 10 07:45 README.md -rwxrwxr-x 1 cryptosoaring cryptosoaring 9998 Jan 10 07:45 bot.js -rwxrwxr-x 1 cryptosoaring cryptosoaring 526 Jan 10 07:45 config.json drwxrwxr-x 2 cryptosoaring cryptosoaring 4096 Apr 29 14:45 contracts -rwxrwxr-x 1 cryptosoaring cryptosoaring 370 Jan 10 07:45 hardhat.config.js drwxrwxr-x 2 cryptosoaring cryptosoaring 4096 Apr 28 23:01 helpers -rwxrwxr-x 1 cryptosoaring cryptosoaring 288618 Jan 10 07:45 package-lock.json -rwxrwxr-x 1 cryptosoaring cryptosoaring 477 Jan 10 07:45 package.json drwxrwxr-x 2 cryptosoaring cryptosoaring 4096 Apr 28 23:01 scripts drwxrwxr-x 2 cryptosoaring cryptosoaring 4096 Apr 28 23:01 test

drwxrwxr-x 5 cryptosoaring cryptosoaring 4096 Apr 28 22:55 hardhat-tutorial drwxrwxr-x 6 cryptosoaring cryptosoaring 4096 Apr 28 23:01 trading_bot drwxrwxr-x 2 root root 4096 Apr 29 14:42 trading_botold

I don't know why the trading_botold got assigned root. How can I delete the folder. I used rm and rmdir to remove the contents but I can't seem to remove the folder.

aeschli commented 6 months ago

rm -r folderName to remove a folder with content. If root access is needed use sudo rm -r folderName.

Closing the issue. It's not an issue of the WSL extension, as the WSL extension doesn't do anything with permissions here, it just uses the default user.