# How to access remote systems over Meshnet using SSH

## Introduction <a href="#introduction" id="introduction"></a>

With the advancement of technology, remote system management has become crucial in today's digital landscape. [Secure Shell](https://en.wikipedia.org/wiki/Secure_Shell) (SSH) is a popular choice when it comes to accessing remote servers, desktop computers, and devices like Raspberry Pi due to its flexibility and efficiency. While the client-server architecture of SSH makes communication between devices secure, it is not completely risk free, especially if you rely on password authentication.

Used in conjunction with [Meshnet](https://nordvpn.com/meshnet/), the SSH method can be as safe as physically accessing the server. Not only does Meshnet save time and travel costs, allowing you to connect directly to your remote device, but it also protects your SSH connection. Using an SSH key pair to authenticate your identity provides an additional layer of security by reducing the risk of password-based attacks.

This article explains what an SSH connection is, how it can be established via Meshnet, and how you can generate an SSH key pair to additionally protect the connection.

## What is SSH? <a href="#what-is-ssh" id="what-is-ssh"></a>

SSH is a command-line access method that lets you log in to another computer, execute commands, and transfer files between computers.

Being a lightweight protocol, SSH is typically used for remote server administration and is especially prevalent in the Linux infrastructure.

## Using SSH on Linux, Windows, and macOS <a href="#using-ssh-on-linux-windows-and-macos" id="using-ssh-on-linux-windows-and-macos"></a>

While SSH is mostly used for controlling Linux machines, both Windows and macOS can also be accessed using this method. All three operating systems employ an open-source implementation of SSH tools called [OpenSSH server](https://www.ssh.com/academy/ssh/openssh).

### Enable SSH access <a href="#enable-ssh-access" id="enable-ssh-access"></a>

To make your device accessible via SSH, you need to install and enable the OpenSSH server software.

{% tabs %}
{% tab title="Linux" %}
{% hint style="info" %}
**Note**

In this guide, Ubuntu 22.04.1 LTS serves as the example for the provided instructions.
{% endhint %}

To install SSH server on Linux:

1. Open the terminal and install the SSH server by running this command:

   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo apt update &#x26;&#x26; sudo apt install openssh-server
   </code></pre>

   &#x20;
2. Once the installation is complete, confirm that the SSH service is running by checking its status. The output should tell you that the service is active. Run the following command:\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo systemctl status ssh
   </code></pre>

   &#x20;
3. To prevent the firewall from blocking your remote connection, open the SSH port by typing:

   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo ufw allow ssh
   </code></pre>

You can now connect to your Linux system via SSH from any remote device over Meshnet.
{% endtab %}

{% tab title="Windows" %}
To enable SSH on Windows, complete the following steps:

1. Open **Settings** and select **System** > **Optional features**.
2. Click **View features**.
3. In the search field, type in `OpenSSH`, select the **OpenSSH Server** checkbox, and click **Next**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FrdAGlcgBONtkDIkBqikJ%2Fwin_ssh_server_dark.png?alt=media&#x26;token=0f0350f4-313e-44aa-8607-cbe75e668148" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FQlO8QUf1uX0Nja4YuA8b%2Fwin_ssh_server.png?alt=media&#x26;token=32b426e3-13ff-4d9a-883b-7d3cb6758822" alt="OpenSSH Server feature." width="375"></picture><figcaption></figcaption></figure></div>

   &#x20;
4. Click **Add**.
5. Once the installation is finished, open PowerShell as an administrator by pressing the **Windows** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FGTHMj8B4fgledLDhPDUm%2Ficon_win_start_11_blue.svg?alt=media&#x26;token=045c5a29-141c-44c1-9dfa-08d59d6bf047" alt="" data-size="line"> key + **R**, typing in `powershell`, and pressing **Ctrl** + **Shift** + **Enter**.
6. Run the following command to start the OpenSSH server process:

   &#x20;

   <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">Start-Service sshd
   </code></pre>

   &#x20;
7. Ensure the SSH service is enabled each time you reboot your computer using this command:\
   &#x20;

   <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">Set-Service -Name sshd -StartupType 'Automatic'
   </code></pre>

You can now connect to your Windows machine via SSH from any remote device over Meshnet.
{% endtab %}

{% tab title="macOS" %}
To connect to your Mac using SSH, you need to enable remote login in your system settings.

1. Choose the Apple menu <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyGn7Su8JV1Xmr9swNsms%2Ficon_apple_blue.svg?alt=media&#x26;token=208432fb-3feb-4235-9437-00302fdd60b3" alt="" data-size="line"> > **System settings** > **General**, and click **Sharing**.
2. Under **Advanced**, turn on the **Remote login** toggle.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FmdkgGaqMQdo7MRNfeX6u%2Fmac_remote_login_dark.png?alt=media&#x26;token=ccc816e3-bc5d-4904-852e-83d85d85b5de" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FVyf51WwGHZOqczGbJOo3%2Fmac_remote_login.png?alt=media&#x26;token=fcade6ea-55c3-4cba-a807-8d541da052fa" alt="Remote login option"></picture><figcaption></figcaption></figure></div>

   &#x20;
3. If needed, select the Info <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FOn4eqQIaY5SNditezKz4%2Ficon_mac_info_blue.svg?alt=media&#x26;token=95c5f2e5-031d-4199-9a0a-43c7006410b3" alt="" data-size="line"> and turn on the **Allow full disk access for remote users** option.
4. Optionally, specify which users can log in.

You can now connect to your Mac via SSH from any remote device over Meshnet.
{% endtab %}
{% endtabs %}

### Connect to your remote computer through SSH <a href="#connect-to-your-remote-computer" id="connect-to-your-remote-computer"></a>

Before attempting to connect, ensure you have the correct username for the remote computer account.

{% hint style="success" %}
**Tip**

To view your username, run the following command in **Command Prompt** (on Windows) or **Terminal** (on Linux or macOS):

```
whoami
```

{% endhint %}

{% tabs %}
{% tab title="Windows, macOS, and Linux" %}
To access your remote system via SSH from a desktop device:

1. Open **Command Prompt** (on Windows) or **Terminal** (on Linux or macOS).
2. Enter the following command, where `<username>` is your remote PC account name and `<server>` is the Nord name or Meshnet IP of the computer you want to access:

   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ssh &#x3C;username>@&#x3C;server>
   </code></pre>

   &#x20;\
   **Example**

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ssh ubuntu@100.105.90.201
   </code></pre>

   or

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ssh ubuntu@secret.meerkat-altai.nord
   </code></pre>

   &#x20;
3. The first time you connect, you will be asked to verify the authenticity of the server. This message is displayed to make sure you’re connecting to the correct remote server. Type `yes` to continue, as shown:

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FZ2djmX7B8BBcnpB5dMwB%2Fwin_ssh_finger.png?alt=media&#x26;token=9d8984e1-772f-4b81-9af5-d413f0f8de4f" alt="SSH key fingerprint confirmation"><figcaption></figcaption></figure></div>

   &#x20;
4. Enter the password for the specified username.

You should now be connected to your remote device using SSH.
{% endtab %}

{% tab title="Android" %}
To access your remote system via SSH from an Android device:

1. Download and install the [ConnectBot](https://play.google.com/store/apps/details?id=org.connectbot) SSH client from the Google Play Store.
2. Open **ConnectBot**.
3. Tap the plus (+) button to add a host device.
4. Under **Protocol**, enter the following information, where `<username>` is your remote PC account name and `<server>` is the Nord name or Meshnet IP of the computer you want to access.\
   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">&#x3C;username>@&#x3C;server>
   </code></pre>

   &#x20;\
   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FrB1XwfPBVSDZKeoPbZPh%2Fandroid_ssh_details.png?alt=media&#x26;token=c4a43946-fab9-4eee-8739-9c0664a0e08d" alt="Remote device&#x27;s username and hostname" width="375"><figcaption></figcaption></figure></div>

   &#x20;
5. Tap the plus (+) button in the upper-right corner.
6. Select the newly added host device to initiate a connection.
7. Enter the password for the specified username.

You should now be connected to your remote device using SSH.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FspodeH5Dlbd6suHSlA9w%2Fimage.png?alt=media&#x26;token=075ec3e6-76a9-40b7-9ded-11b33774bada" alt="Terminal of the remote device." width="375"><figcaption></figcaption></figure></div>
{% endtab %}

{% tab title="iPhone/iPad" %}
To access your remote system via SSH from an iOS device:

1. Download and install the [WebSSH](https://apps.apple.com/us/app/webssh-sysadmin-tools/id497714887) application from the Apple App Store.
2. Open **WebSSH**.
3. To add a new host device, tap the empty area of the main screen or the plus button in the upper-right corner.
4. Specify the following information:
   * In the **Host** field, enter the Nord name or Meshnet IP of the remote PC.
   * In the **User** field, enter the account name of the remote computer.
   * In the **Password** field, enter the authentication password of the user account.

     &#x20;\
     **Example**

     <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FmfsnlzaTJiZkaThksIwa%2Fios_ssh_details.png?alt=media&#x26;token=6cbc3d69-9ec1-45af-9187-22089682f094" alt="Remote device&#x27;s details for SSH connection." width="352"><figcaption></figcaption></figure></div>

     &#x20;
5. Tap the check mark button in the upper-right corner.
6. From the main application screen, tap the newly added device to initiate a connection.
7. Tap **Continue** to confirm the host key fingerprint.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FDxx9REzRCDqRu68yAphI%2Fios_ssh_finger.png?alt=media&#x26;token=022c17f3-e75a-4c8d-a6dd-50eafa1c8b14" alt="SSH fingerprint confirmation." width="270"><figcaption></figcaption></figure></div>

You should now be connected to your remote device using SSH.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FMu23D6YGWvu1Jkzzpnze%2Fios_ssh.png?alt=media&#x26;token=643d9330-a394-4f31-af78-e3414aee8b47" alt="Terminal of the remote device"><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

## Configuring SSH keys <a href="#configuring-ssh-keys" id="configuring-ssh-keys"></a>

An [SSH key](https://www.ssh.com/academy/ssh-keys) is a cryptographic key that is used for user authentication while establishing an SSH connection. It increases the security of SSH connections and allows for efficient automation, as it doesn't require human intervention for authentication.

### Generate an SSH key <a href="#generate-an-ssh-key" id="generate-an-ssh-key"></a>

To use key-based authentication, you first need to generate a key pair on the device from which you will be making an SSH connection.

1. Run the following command in **Command Prompt** (on Windows) or **Terminal** (on Linux or macOS):

   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ssh-keygen
   </code></pre>

   &#x20;
2. Press **Enter** to keep the default file location.
3. For additional security, you can choose a custom password. Otherwise, press **Enter**.

A pair of keys (private and public) will be generated with the same `id_rsa` name. However, the public key can be distinguished from the private key by its file extension, which is `.pub`.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FKgyKAHmUpsck71ErvgJs%2Fssh_key_gen.png?alt=media&#x26;token=d44acb72-eb46-45e3-aa86-7d1be9ec5a6b" alt="SSH keys generated"><figcaption></figcaption></figure></div>

### Copy your public SSH key to a remote device <a href="#copy-your-public-key-to-a-client-device" id="copy-your-public-key-to-a-client-device"></a>

To use SSH keys for authentication, you need to copy the public key of your device to the device you will be accessing. For example, if you are using Windows and want to connect to a Linux server, you need to copy the public SSH key of the Windows device to the Linux machine.&#x20;

When establishing an SSH connection, the public key is matched with the private key to authorize the connection.

<details>

<summary>Allow SSH key authentication on Windows</summary>

To connect to a Windows device using an SSH key, you must first enable public key authentication. Otherwise, you will be asked to enter the SSH password even after sharing the public key.&#x20;

On the remote device that you will be accessing, take the following steps:

1. Open **PowerShell** as an administrator.
2. Navigate to the `ssh` folder by using the `cd` command:\
   &#x20;

   <pre class="language-batch" data-overflow="wrap"><code class="lang-batch">cd C:\ProgramData\ssh
   </code></pre>

   &#x20;
3. Run the following command to create a new `administrators_authorized_keys` file which will store the public keys of the connecting devices:\
   &#x20;

   <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">New-Item -ItemType File -Name administrators_authorized_keys
   </code></pre>

   &#x20;
4. Update the permissions to the newly created file with the following command:\
   &#x20;

   <pre class="language-batch" data-overflow="wrap"><code class="lang-batch">icacls administrators_authorized_keys /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
   </code></pre>

   &#x20;
5. Run the command below to open the `sshd_config` file:\
   &#x20;

   <pre class="language-batch" data-overflow="wrap"><code class="lang-batch">notepad sshd_config
   </code></pre>

   &#x20;
6. Locate and uncomment the `PubkeyAuthentication yes` line by removing the hash (`#`) symbol at the start.

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FccdiV0hlFlwV3Lt8VaY8%2Fwin_ssh_pubkey_dark.png?alt=media&#x26;token=1681c3b9-2721-45cd-b1a3-654cc79ed4c2" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FdtKwFlRjLZjIa34dNmyn%2Fwin_ssh_pubkey.png?alt=media&#x26;token=27f97127-f9e5-4c43-83b9-52cbfd5a8dc0" alt="&#x22;PubkeyAuthentication yes&#x22; line highlighted in Notepad."></picture><figcaption></figcaption></figure>

   &#x20;
7. Press **Ctrl** + **S** to save changes and exit **Notepad**.

</details>

{% tabs %}
{% tab title="From Windows" %}
To exchange the SSH public key, follow these steps on the device from which you want to establish an SSH connection:

1. Open **PowerShell**.
2. Depending on the device that you will be accessing, run the following appropriate commands, where `<username>` is the username of the remote device's account and `<server>` is the remote device’s Nord name or Meshnet IP.
   * If you're copying your SSH key to a Linux or a macOS device, use this command:\
     &#x20;

     <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">type $env:userprofile\.ssh\id_rsa.pub | ssh &#x3C;username>@&#x3C;server> "cat >> .ssh/authorized_keys"
     </code></pre>

     &#x20;\
     **Example**

     <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">type $env:userprofile\.ssh\id_rsa.pub | ssh ubuntu@secret.meerkat-altai.nord "cat >> .ssh/authorized_keys"
     </code></pre>

     &#x20;
   * If you're copying your SSH key to a Windows device, use the following three commands:\
     &#x20;

     <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">$PublicKey = Get-Content "$env:userprofile\.ssh\id_rsa.pub"
     $CopyKey= "echo $PublicKey >> %programdata%\ssh\administrators_authorized_keys"
     ssh &#x3C;username>@&#x3C;server> $CopyKey
     </code></pre>

     &#x20;\
     **Example**

     <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">$PublicKey = Get-Content "$env:userprofile\.ssh\id_rsa.pub"
     $CopyKey = "echo $PublicKey >> %programdata%\.ssh\administrators_authorized_keys"
     ssh meshnet@secret.meerkat-andes.nord $CopyKey
     </code></pre>

     &#x20;
3. If prompted, type in yes and press **Enter** to confirm the key fingerprint.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FZ2djmX7B8BBcnpB5dMwB%2Fwin_ssh_finger.png?alt=media&#x26;token=9d8984e1-772f-4b81-9af5-d413f0f8de4f" alt="SSH key fingerprint confirmation"><figcaption></figcaption></figure></div>

   &#x20;
4. Enter the remote device’s account password and press **Enter**.
   {% endtab %}

{% tab title="From Linux and macOS" %}
To exchange the SSH public key, follow these steps on the device from which you want to establish an SSH connection:

1. Open **Terminal**.
2. Run the following command, where `<username>` is the username of the remote device's account and `<server>` is the remote device’s Nord name or Meshnet IP:

   &#x20;

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ssh-copy-id &#x3C;username>@&#x3C;server>
   </code></pre>

   &#x20;\
   **Example**

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ssh-copy-id ubuntu@secret.meerkat-altai.nord
   </code></pre>

   &#x20;
3. If prompted, type in `yes` and press **Enter** to confirm the key fingerprint.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FfzB7STOF1TbbmV6rHD8U%2Fssh_key_fingerprint.png?alt=media&#x26;token=ddf5f584-24cc-4f3d-bf33-e3641a50ec4a" alt="SSH key fingerprint confirmation"><figcaption></figcaption></figure></div>

   &#x20;
4. Enter the remote device’s account password and press **Enter**.

You will see a message that the key has been added.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FhAF14l1eSwp5XdGcbtuS%2Fssh_key_added.png?alt=media&#x26;token=958355d6-6b10-4ee3-9feb-698de65536fd" alt="SSH key added"><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

Once the SSH key exchange is complete, you can use the same format to establish an SSH connection to the remote device:

{% code overflow="wrap" %}

```bash
ssh <username>@<server>
```

{% endcode %}

However, you will not be prompted to enter a password unless you choose a passphrase while generating the SSH key. And now you can securely access your remote device via SSH over Meshnet.

## (Showcase) SSH connection using Visual Studio Code

A tool that is often used by beginners and novices alike for SSH connection is Visual Studio Code (VS Code). At its core, VS Code is an integrated development environment (IDE). However, with the help of a vast marketplace, it can be used as a powerful tool for remote server management.

### Install VS Code

You can download VS Code for Windows, macOS, and Linux from the [VS Code downloads page](https://code.visualstudio.com/download). Choose the file appropriate for your operating system and install the app.

### Install the SSH extension

Once you have installed VS Code, you need to install an extension that will allow you to establish SSH connections to remote devices.

1. Launch **VS Code**.
2. From the left sidebar, select **Extensions**.
3. In the search field, type in `Remote - SSH` and select the corresponding option.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FxkMcfUEidhhVK7BrSl23%2Fssh_code_search_dark.png?alt=media&#x26;token=fa5eae93-5100-4a3a-9f86-1398e84b7051" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FkY9KOa8Ho4bNXsTGjurY%2Fssh_code_search.png?alt=media&#x26;token=3b743f33-9372-4c18-b444-12dc78eb0e2b" alt="Selecting the &#x22;Remote - SSH&#x22; extension from the marketplace." width="314"></picture><figcaption></figcaption></figure></div>

   &#x20;
4. Click **Install**.

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FypmDh4tEpzQA3veN5msR%2Fssh_code_install_dark.png?alt=media&#x26;token=aeeff422-a698-4be5-afb9-edf4367a87cd" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F2YEuRFUNpFwri8ssIdic%2Fssh_code_install.png?alt=media&#x26;token=4e93c31f-6dae-4b19-9d7e-44306cfbec7d" alt="&#x22;Install&#x22; button highlighted."></picture><figcaption></figcaption></figure>

### Add a new SSH host device

Next, create a new entry in your system's SSH configuration file for the remote device you want to access directly from the VS Code app. This saved information enables VS Code to display all configured host devices, allowing you to quickly connect to any of them.

1. From the left sidebar, select the **Remote explorer** tab.
2. Next to **SSH**, click **New remote**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F88QN7xa7bEnvDgha8ytd%2Fssh_code_new_dark.png?alt=media&#x26;token=627a4fb1-aa0a-4132-b04c-8d51814963f4" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FbDT9A0YUgF2jilIyXHJ7%2Fssh_code_new.png?alt=media&#x26;token=83c9bad0-5183-4a44-9939-fb3c41361129" alt="Arrow pointing to the &#x22;New remote&#x22; button next to SSH." width="350"></picture><figcaption></figcaption></figure></div>

   &#x20;
3. In the text field, type in the command to access the remote device using SSH. \
   &#x20;\
   **Example**

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FlqBViYkaq708ARJ73ei3%2Fssh_code_command_dark.png?alt=media&#x26;token=331b07ec-f795-4334-97f7-5d0fc2b4b806" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FCOUZsEBTBQi3b5dtiE4J%2Fssh_code_command.png?alt=media&#x26;token=d8ee0601-8d60-472c-99d5-3998ff270c9e" alt="SSH command entered in the provided text field."></picture><figcaption></figcaption></figure>

   &#x20;\
   See the [Connect to your remote computer through SSH](#connect-to-your-remote-computer) section above for more details.
4. Select in which SSH configuration file the connection should be saved.

VS Code should prompt a notification that the host has been added.

### Establish the SSH connection

Finally, you can connect to the added host device using the Remote - SSH extension.

1. In the **Remote explorer** tab, under **SSH**, locate your newly added connection.
2. Click **Connect in current window**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fi3UJ32CV8MgfmRPp3FwU%2Fssh_code_connect_dark.png?alt=media&#x26;token=04da65e0-c0fe-41e1-9a2f-cff75757203f" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F8P3ngsN5pX7ZivYxanSX%2Fssh_code_connect.png?alt=media&#x26;token=865b7e9a-293c-4715-bdc1-139f8d804310" alt="Arrow pointing to the &#x22;Connect in current window&#x22; button." width="373"></picture><figcaption></figcaption></figure></div>

   &#x20;
3. Select the operating system of the remote device and, if prompted, click **Continue** to confirm the device fingerprint.
4. Enter the password of the remote user account and press **Enter**.

The first connection may take some time, while the relevant packages are installed. After that, you can control the remote device's CLI and navigate its directories using VS Code.

{% hint style="info" %}
**Note**

If the remote device is not visible under the **SSH** section, click the **Refresh** button next to **Remotes (tunnels/SSH)**.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://meshnet.nordvpn.com/how-to/remote-access/access-remote-systems-over-ssh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
