Skip to content

Commit e1fb32e

Browse files
author
mikeblome
committed
updates per Sam Freed for remote connections
1 parent 1494fc5 commit e1fb32e

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

docs/linux/connect-to-your-remote-linux-computer.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,10 @@ You can configure a Linux project to target a remote machine or to Windows Subsy
1919

2020
## Connect to a remote Linux computer
2121

22-
When building a C++ Linux project for a remote Linux system (VM or physical machine), Linux code is copied to your remote Linux computer and then compiled based on Visual Studio settings. (In Visual Studio 2017, use these instructions to connect to WSL also. Use **localhost** for the **Host Name**.)
22+
When building a C++ Linux project for a remote Linux system (VM or physical machine), Linux code is copied to your remote Linux computer and then compiled based on Visual Studio settings.
2323

2424
To set up this remote connection:
2525

26-
1. Create a private key file (or [reuse an existing one](https://security.stackexchange.com/questions/10203/reusing-private-public-keys)). Currently only RSA and DSA keys are supported. You can create a private RSA key file by following these steps:
27-
28-
1. On the Windows machine, create the ssh key pair with `ssh-keygen -t rsa`
29-
30-
1. From Windows, copy the public key to the Linux machine: `scp -p C:\Users\<USERNAME>\.ssh\id_rsa.pub user@hostname`:
31-
32-
1. On the Linux system, add the key to the list of authorized keys (and ensure the file has the correct permissions): `cat ~/id_rsa.pub >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys`
33-
34-
1. In Visual Studio, add the connection (in Connection Manager). The default private key name is `C:\Users\<USERNAME>\.ssh\id_rsa`.
35-
3626
1. Build the project for the first time or manually create a new entry by selecting **Tools > Options** and then open the **Cross Platform > Connection Manager** node and click the **Add** button.
3727

3828
![Connection Manager](media/settings_connectionmanager.png)
@@ -53,7 +43,16 @@ To set up this remote connection:
5343
| **Private key file** | Private key file created for ssh connection
5444
| **Passphrase** | Passphrase used with private key selected above
5545

46+
You can use either a password or key file and passphrase for authentication. For many development scenarios, password authentication is sufficient. If you prefer to use a public/private key file, you can create a new one or [reuse an existing one](https://security.stackexchange.com/questions/10203/reusing-private-public-keys). Currently only RSA and DSA keys are supported.
5647

48+
You can create a private RSA key file by following these steps:
49+
50+
1. On the Windows machine, create the ssh key pair with `ssh-keygen -t rsa`. This will create a public key and a private key. By default the keys are placed under `C:\Users\%USERNAME%\.ssh` with names `id_rsa.pub` and `id_rsa`."
51+
52+
1. From Windows, copy the public key to the Linux machine: `scp -p C:\Users\%USERNAME%\.ssh\id_rsa.pub user@hostname`:
53+
54+
1. On the Linux system, add the key to the list of authorized keys (and ensure the file has the correct permissions): `cat ~/id_rsa.pub >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys`
55+
5756
1. Click the **Connect** button to attempt a connection to the remote computer.
5857

5958
If the connection succeeds, Visual Studio will begin configuring IntelliSense to use the remote headers. For more information, see [IntelliSense for headers on remote systems](configure-a-linux-project.md#remote_intellisense).
@@ -62,6 +61,8 @@ To set up this remote connection:
6261

6362
![Connection Manager Error](media/settings_connectionmanagererror.png)
6463

64+
If you are using key files for authentication, ensure the target machine's SSH server is running and configured properly.
65+
6566
::: moniker-end
6667

6768
::: moniker range="vs-2019"
@@ -76,6 +77,14 @@ To set up this remote connection:
7677

7778
## Connect to WSL
7879

80+
::: moniker range="vs-2017"
81+
82+
In Visual Studio 2017, you connect to WSL by using the same steps as connecting to a remote Linux machine as described earlier in this article. Use **localhost** for the **Host Name**.
83+
84+
::: moniker-end
85+
86+
::: moniker range="vs-2019"
87+
7988
In Visual Studio 2019 version 16.1, it is not necessary to add a remote connection or configure SSH when targeting WSL. All that is required on the Linux system is gcc, gdb, make, rsync, and zip. Visual Studio requires rsync and zip only to extract header files on first use from your WSL instance to the Windows filesystem to use for IntelliSense. In Visual Studio 2019 version 16.1, WSL support is based on Windows version 1809. You can be running a later version of Windows, but Visual Studio does not yet take advantage of new WSL capabilities.
8089

8190
If your distro supports apt, you can install the required packages with this command:

0 commit comments

Comments
 (0)