"Opening Visual Studio Code as Root is an horrible idea", that's basically what everyone says on the web. But, how the hell are you supposed to work directly on a project directory where you can't change file/directory permissions (which is the real horrible idea) and you need to edit a lot of files quickly? I mean, i'm not doing sudo nano file on every single file just for a panic sake advice.
When you try to run VSCode as root (with super user permissions) with the following command in the terminal:
The application will throw the following error message:
It is recommended to start vscode as a normal user. To run as root, you must specify an alternate user data directory with the
In order to open Visual Studio Code as root user, you can simply run the following command in the terminal:
sudo code --user-data-dir="~/.vscode-root"
This will allow you to edit any file on the system as you are running it as root. It's worth to say that you need to be careful, as you have all the permissions, so just try to don't delete anything accidentally, would you?.
Happy coding !
Become a more social person