Use VS Code with the Remote Development plug-in connection to the remote server (Mac / Linux + Windows) | Using VS Code with Remote Development Connect to Remote Server (Mac / Linux + Windows)

The latest version of VS Code (2019 June 2011) a series of new plug-ins, including the Remote Development, Remote SSH, etc., so that the user can use the remote connection server VS Code write code to facilitate the work. Specific configuration (Mac / Linux, Windows) as follows:

  1. First, the search plug-ins in the market, you can install the Remote Development will be a series of plug-ins, including installation, etc. Remote SSH together.

  2. Next you need to generate the key ssh.
    Open a command line, enter:
    SSH-keygen -t rsa -b 4096
    Next, enter the save path (the default is empty ./.ssh/id_rsa) and password.

  3. After generating the ssh key, ssh key needs to be put on a remote server.
    For Mac / Linux, enter the following command:
    · · ·
    SSH-Copy-the above mentioned id the User-your-name-ON-the FQDN of the Host-Host @-or-ip-goes-here Wallpaper
    · · ·

Respect to windows, then each enter the following command:
?????
the SET = the REMOTEHOST-your-User-name @ ON-Host-Host-FQDN or IP--goes-here Wallpaper

scp %USERPROFILE%.ssh\id_rsa.pub %REMOTEHOST%:~/tmp.pub

ssh %REMOTEHOST% "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat ~/tmp.pub >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && rm -f ~/tmp.pub"
···

  1. Next, you can configure ssh to log files and the remote server. Below, click Configure a SSH host:

Ssh key selection path of the just generated (./.ssh/config)

Enter the corresponding content, including Host, User, HostName (%% replaced in the text). Ssh if not stored in the default directory, you can also denote a particular input IdentityFile to save path.
· · ·
Host% name%
HostName% ip%
the User the User%%
IdentityFile% path%
· · ·
Once configured, you can connect up!

Note:
For Windows, if the connection can not be open powershell under administrator privileges, enter the following command to configure ssh service.
· · ·
The Set-Service SSH-Agent -StartupType Automatic
Start-Service SSH-Agent
the Get-Service SSH-Agent
· · ·

References:
https://code.visualstudio.com/docs/remote/troubleshooting#_configuring-key-based-authentication

Guess you like

Origin www.cnblogs.com/kkyyhh96/p/11026814.html