Search code examples
visual-studio-codevscode-remotessh-config

How to set ControlMaster with Remote-SSH in Visual Studio Code?


I use Visual-Studio-Code with Remote-SSH extension and I don't want to authentiaction multiple times after I login. So I search the ControlMater option with ssh_config to setup.

After I connected and I got below error message.

Can't connect to Leo-OA: unreachable or not Linux x86_64 (packet_write_poll: Connection to UNKNOWN port -1: Permission denied)

My environment:

Client:

    Visual Studio Code 1.35 Stable

    Windows 10 1803

Server: 

    Ubuntu 16.04 LTS

Below is my setting file

# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
Host STONE-OA
    HostName 10.32.21.123
    User rock

Host Leo-OA
    HostName 10.32.21.123
    User root
    Port 60001

Host *
    ControlMaster auto
    ControlPath ~/.ssh/sockets/%r@%h-%p
    ControlPersist 600

I want to know what is the main problem and how to fix. Thanks everybody.


Solution

  • This feature is not supported on Windows. Simply running ssh on Windows with ControlMater in PowerShell without VS code has problem too. However you can use ControlMater in WSL without problem.

    https://code.visualstudio.com/docs/remote/troubleshooting#_enabling-alternate-ssh-authentication-methods

    If you are on macOS and Linux and want to reduce how often you have to enter a password or token, you can enable the ControlMaster feature on your local machine so that OpenSSH runs multiple SSH sessions over a single connection.