How to lock root privileged VS code to Ubuntu Launcher? - ubuntu-16.04

I am using VSCODE for obvious purpose and I am running it via root permissions on Ubuntu using a command
sudo code --user-data-dir="~/.vscode-root"
Problem-
My Ubuntu Launcher has a VSCODE icon but that VSCODE is not a root user and each time I want to run it as a root user, I have to run the above command.
How can I fix the VSCODE with root privileges in my Ubuntu Launcher for quick access?

Related

vscode opens a white screen when running in super-user mode

I've installed vscode on my ubuntu and I'm trying to run it with root privileges.
I understand there is a problem with this version and root privileges.
I use this command from my terminal:
sudo code /my_fils --user-data-dir='.' --no-sandbox
but when running it vscode opens a blank and white screen with super-user definition on top but with nothing else.
I know there was a problem with this configuration and I found this issue in this link :
https://code.visualstudio.com/updates/v1_59#_progress-for-electron-sandbox-support
I've tried the following but the outcome is the same:
sudo chown root /chrome-sandbox
sudo chmod 4755 /chrome-sandbox
running vscode without the root privilege works.
I'm using ubuntu 20.04 and my vscode version is 1.70.2
is there a workaround for it?
thanks !!
Yes, this seems to be an issue try 1.65.x it might run. encountered the same when installing a fluent theme.
Checkout : https://github.com/microsoft/vscode/issues/146847

Blank window vscode as root

it's been a long time that i run vscode as root via this command (ubuntu 20.04.4 LTS) :
> sudo code --user-data-dir="~/.vscode-root"
Today, i used the same command to execute vscode as root, but i don't have the same result.
in this time, i have a blank window.
i tried to remove it + remove /$Home/Code and .vscode folder
install it again but i have the same problem,
i tried to use the same command with other flags without being able to solve it.
Flags tried : --disable-gpu /// --disable-features=CalculateNativeWinOcclusion
is there a way to delete (package + config) and all data of vscode to install it properly again ?
screen shot
Any idea ?
Thank you & have a nice day
That works for me on VSCodium:
sudo su -c "codium --user-data-dir="/root" --no-sandbox && sleep infinity"
For some reason, vscode does not start with sudo, but it works calmly with su -c
PS: I do not know if it can be done easier. I needed this to work with git in vscode

source /opt/anaconda3/bin/activate failed

anaconda version: 4.10.1.
anaconda is installed with root in /opt/anaconda3.
another user mingming tries to source /opt/anaconda3/bin/activate and shell never return until CTRL + C. mingming has rwx access to all files and directories in /opt/anaconda3. I am trying to install anaconda with root and make all other users can use it to create their own environment.
I found out that conda init alternate PATH in an endless loop, but why this is happening?

Visual Studio Code is not working on WSL2

When I try open VS Code in WSL2 Terminal, like this:
code .
I get the following error:
mkdir: cannot create directory {DIRECTORY} : Permission denied
When started with sudo:
sudo: code: command not found
I added VS Code to my PATH on Windows, and installed WSL-Remote
I am working on:
Windows 10 Pro 10.0.19041
WSL 2
Ubuntu 20.04 LTS
VS Code 1.47.1
Check the configure file(/etc/sudoers), you need to modify the secure_path to enable run VS code with sudo command.
Also, it is better if you put the command path into /etc/profile, so every user could run VS code.

start ubuntu as terminal in project folder

I added the following line to my settings in VSCode:
"terminal.integrated.shell.windows": "C:\\Users\\bd\\AppData\\Local\\Microsoft\\WindowsApps\\ubuntu.exe"
When I now start a terminal ubuntu is started in my user's home folder. How is it possible to start ubuntu in the project folder?
The thing is wsl can start any linux that I set using wsl /setdefault I dont like to rely on such a setting but want to specify the one I want to start. I want it started in the project's folder.
Edit:
I change into some project directory and call wslconfig.exe /s Legacy. When I now invoke wsl Bash is started in the current folder.
I return to cmd and call wslconfig.exe /s Ubuntu. When I now call wsl Store Ubuntu is started in the current folder.
wsl.exe seems to start Ubuntu differently than ubuntu.exe does. ubuntu.exe always starts in the user's home dir.
I assume that what you want to run in the VSCode terminal is the Windows Subsystem for Linux (in particular the Ubuntu variant).
To do so, you should run wsl.exe, using this setting:
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\wsl.exe",
This will start up a Windows Subsystem for Linux shell inside the terminal. If you have installed Ubuntu, that is what will be run.