Search code examples
ubuntuvisual-studio-coderemote-serverubuntu-20.04vscode-remote

I cannot open a new VSCode instance from the integrated VSCode terminal while being a non-root superuser on Ubuntu 20.04


I use a VSCode to connect to a remote server using ssh.

Currently, only the files in the root folder are displayed by VSCode. I have a superuser dacomis that contains a folder named cardano-v. I would like to be able to create a new instance of VSCode using code . or code -n cardano-v. The new instance should display the content of the folder like in the first picture where I was the root user.

When I follow the same steps as above while being the superuser dacomis for the folder cardano-v, nothing happens. (2nd picture) I installed VSCode on the user using snap.

What can I do? Thank you!

1st picture 2nd picture


Solution

  • I think I resolved my problem. In the .ssh/config file on my Windows machine that I use to connect to the remote server, I have there were 2 instances that were trying to connect to the same server:

    Host -serverIP-
      HostName -serverIP-
      User root
    
    Host -serverIP-
      HostName -serverIP-
      User dacomis
    

    I deleted the content of this file, I established a new connection with the remote server from VSCode using the Remote Server extension and the command ssh dacomis@-serverIP-. Where dacomis is the superuser that I would like to connect to.

    Now the .ssh/config file contains only this user:

    Host -serverIP-
      HostName -serverIP-
      User root
    

    Now I am able to connect to the remote server and create a new VSCode instance with a folder using the famous command code testFolder and my integrated bash terminal is by default opened on the dacomis superuser and not root.