# SSH

## About SSH

#### What is SSH?

**SSH** (Secure Shell Protocol) is a protocol for securely connecting to remote servers. It encrypts your connection, allowing you to:

* Log in safely
* Run commands remotely
* Transfer files without exposing your data

#### SSH Connection on Pictor

You can access Linux instances rented on Pictor using SSH. When connecting via SSH, you authenticate using a private key file on your local machine.

To establish an SSH connection to your Pictor Linux Instances, you need an SSH key pair. This pair consists of:

* **Public Key**: This key will be added to the Pictor Instance configuration to grant access.
* **Private Key**: This key will be used for authentication during instance connection. You must keep it absolutely secret on your local machine.&#x20;

<img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FRm5hoqPo4nLr2VX3SGto%2Fimage.png?alt=media&#x26;token=a5f61ef9-9232-42a4-9f95-5aa089a0e35c" alt="" data-size="line">If you're unsure whether you already have an SSH key, you can [check for existing SSH keys](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#check-for-existing-ssh-keys).

<img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2Fbda28RqTGPRk7hhiGRIh%2Fimage.png?alt=media&#x26;token=1b31cd26-f5e1-4fd8-be6d-db6f34e61293" alt="" data-size="line"> If you don't already have an SSH key, you must [generate a new SSH key](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#generate-a-new-ssh-key).

<img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FBSxGYYzw6aLn1AtuuB1I%2Fimage.png?alt=media&#x26;token=e69cf235-ec5b-482c-8e1c-6c678bcc5b67" alt="" data-size="line"> If you already have an SSH key, you must [add your SSH **public key** to your Pictor account](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#add-ssh-key-to-pictor-account) for SSH connection.

<img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2Fo6JPeP68kwtzXSI0SIbC%2Fimage.png?alt=media&#x26;token=cf9677f7-753f-4a3d-8295-0443e588cd05" alt="" data-size="line"> To maintain account security, you should regularly [review your SSH keys](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#review-ssh-keys) and delete any keys that are invalid or have been compromised.

***

## Check for existing SSH keys

Before [generating a new SSH key](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#generate-a-new-ssh-key), you should check for existing keys on your local machine.

{% stepper %}
{% step %}

#### Open Terminal

Open a Terminal application on your machine.&#x20;

For example, use PowerShell or Command Prompt on Windows, Terminal.app on macOS, or a Terminal Emulator (like Gnome Terminal or Konsole) on Linux.
{% endstep %}

{% step %}

#### Check for existing SSH keys.

Enter the command to see if existing SSH keys are present.

* On Windows PowerShell, enter

```powershell
Get-ChildItem -Path $HOME\.ssh -Force
```

* On Windows Command Prompt, enter:

```cmd
dir %USERPROFILE%\.ssh
```

* On macOS Terminal.app, enter:

```bash
ls -al ~/.ssh
```

{% endstep %}

{% step %}

#### Check the directory listing

* If you already have a public SSH key, you will see:

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2F95LRTZsc7UWfKcGRnO0k%2FCheck%20for%20existing%20SSH%20key.png?alt=media&#x26;token=aa1f2fbe-1748-48c9-9e60-2a3c6d714d57" alt=""><figcaption></figcaption></figure>

* If you don't have a public SSH key, you will see:

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2F3I3dVd8o0LfnCdBCYdXa%2FCheck%20for%20existing%20SSH%20key%20(2).png?alt=media&#x26;token=77477e71-25df-4500-a4a4-5836304054f9" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Generate a new SSH key or Add an existing one.

* If you don't have a public and private key pair, or don't wish to use any existing key, you can [generate a new SSH key](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#generate-a-new-ssh-key).
* If you want to use your existing one, you can [add your SSH key to your Pictor account](https://docs.pictor.network/docs/services/gpu-renting/connection-methods/ssh#add-ssh-key-to-pictor-account).
  {% endstep %}
  {% endstepper %}

***

## Generate a new SSH key

If you don't already have an SSH key pair or don't wish to use any existing key, you can generate a new SSH key.

**Follow the steps below to generate a key pair in your terminal:**

{% hint style="info" %}
**Note**:&#x20;

The `ssh-keygen` command is a standard utility and is executed the same way across all terminal applications.

We will guide you through the process using Windows PowerShell.
{% endhint %}

{% stepper %}
{% step %}

#### Enter the Keygen Command

Type this command into the PowerShell and press <mark style="color:yellow;">Enter</mark>

```powershell
ssh-keygen -t ed25519 -C "your_email@example.com"
```

{% hint style="info" %}
-C “<your_email@example.com>” is optional.&#x20;

Anything entered there will be saved as a comment in the public key file (for example, id\_ed25519.pub). This comment is intended for identification purposes, which can be helpful if you use multiple keys; it is not intended for security purposes.
{% endhint %}
{% endstep %}

{% step %}

#### Specify the Key Storage Location

Choose where you want to store the key files.&#x20;

* **To use the default path:** simply press <mark style="color:yellow;">Enter</mark>.
* **To use a custom filename/path:** type the desired path/filename (e.g., `C:\Users\<YourUsername>\.ssh\your_custom_filename`) and press <mark style="color:yellow;">Enter</mark>

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FXY37atkGAstFYWY6POJi%2FGenerate%20SSH%20Key_store%20location.png?alt=media&#x26;token=fcc0a8c0-47a8-4f0d-861b-7b8f660bcd75" alt=""><figcaption><p>Save to the default path</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add Passphrase

The Passphrase is an additional layer of security. Adding a passphrase is the **most crucial step** for securing your Private Key. Even if someone obtains your Private Key file, they will not be able to use it without this passphrase.

Type your passphrase and press <mark style="color:yellow;">Enter.</mark>

Type the same passphrase again to confirm and press <mark style="color:yellow;">Enter.</mark>

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FPuexP3rIhtwZbgMWJbjY%2FAdd%20a%20Passphrase.png?alt=media&#x26;token=ceb2d923-17ab-4c71-9e71-9567207274c5" alt=""><figcaption></figcaption></figure>

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

* The passphrase you type will **not be visible** on the screen for security reasons.
* **Leaving it empty** (just pressing <mark style="color:yellow;">Enter</mark>) means your key will not have passphrase protection.
  {% endhint %}

{% endstep %}

{% step %}

#### SSH key is created

Upon successful completion, the system will confirm that your SSH key pair has been saved and is ready for use.

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FOOvK2FMj7vuGwKeFAcxD%2FGenerate%20SSH%20Key_Created%20key.png?alt=media&#x26;token=991a3b49-6eba-483f-8c37-09806186b4fd" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The key comes in pairs:

* id\_ed25519: your **private key**

&#x20;<img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FisAOmL1xrsfRtHiEY6Ck%2Fimage.png?alt=media&#x26;token=87db0057-7e7a-4a66-b46b-7177ae521959" alt="" data-size="line">Keep it safe, never share. You will need this key to access the rented instance via the terminal applications.

* id\_ed25519.pub: your **public key** &#x20;

&#x20;<img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FnrxLCkMkwfYqJqUJ33Cn%2Fimage.png?alt=media&#x26;token=97230564-2b72-4089-9ee2-65b561cdd8ec" alt="" data-size="line">Safe to share. You will add this key to your Pictor account (before creating the instance).
{% endhint %}
{% endstep %}
{% endstepper %}

***

## Add SSH key to Pictor account

Your SSH key generation process created two files in the location you specified.

* **Private Key:** `id_ed25519` (Keep this file private and secure.)
* **Public Key:** `id_ed25519.pub` (This is the key you need to add to your Pictor account)

Before you can create and connect to your rented GPU instance, you must add your Public SSH Key to your Pictor account. This key acts as your secure credential for authentication.

{% stepper %}
{% step %}

#### Open the Terminal

Open a Terminal application on your machine.&#x20;

For example, use PowerShell or Command Prompt on Windows, Terminal.app on macOS, or a Terminal Emulator (like Gnome Terminal or Konsole) on Linux.
{% endstep %}

{% step %}

#### Run the command

* On Windows PowerShell, assuming `C:\Users\<YourUsername>\.ssh\id_ed25519.pub` is your public key filepath, enter:

```powershell
cat C:\Users\<YourUsername>\.ssh\id_ed25519.pub
```

* On Windows Command Prompt, assuming `C:\Users\<YourUsername>\.ssh\id_ed25519.pub` is your public key filepath, enter:

```cmd
type C:\Users\<YourUsername>\.ssh\id_ed25519.pub
```

* On macOS Terminal.app, assuming `id_ed25519.pub` is your public key file, enter:

```bash
cat ~/.ssh/id_ed25519.pub
```

{% endstep %}

{% step %}

#### Get the public key

The terminal will display the entire Public Key as a line of text.&#x20;

**Copy this entire output**, starting with `ssh-ed25519` and including the comment at the end (`hana@pictor.network` here, for example)

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FgKB41R5DUCjZ10oEuzBh%2FAdd%20SSH%20key_Get%20public%20key.png?alt=media&#x26;token=e9aa34ec-e87b-4b46-9a48-487a710d9976" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Add the key to your Pictor account

* Go to [app.pictor.network](https://app.pictor.network/) >> Navigate to **GPU Renting** page on the sidebar >> Under the **Instances** tab, choose **Manage SSH Keys** button.

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2F2SDaHGab6UeaVDO154aN%2FAdd%20SSH%20key_Add%20key-1.png?alt=media&#x26;token=40376df6-c763-40cb-892f-83e370c0b920" alt=""><figcaption></figcaption></figure>

* Click Add **New SSH Key** >> enter your **Key Name** and paste your **Public Key** >> Click **Create SSH Key**.

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FOgtVaIxwo32sYkhM2JQy%2FAdd%20SSH%20key_Add%20key-2.png?alt=media&#x26;token=200d2c5e-c12b-4340-80cb-c21c50cf70ce" alt=""><figcaption></figcaption></figure>

* Your SSH key is added successfully and is ready to be selected when you [create an Instance on Pictor](https://docs.pictor.network/docs/services/gpu-renting/get-started#step-3-create-an-instance).
  {% endstep %}
  {% endstepper %}

***

## Review SSH keys

To maintain account security, you should regularly review your SSH keys list and delete any keys that are no longer valid (or may be compromised).

**How to review your SSH keys:**

1. Go to [app.pictor.network](https://app.pictor.network/)&#x20;
2. Navigate to **GPU Renting** page on the sidebar >> **Manage SSH Keys**
3. Click the **View** button on each key to review its details, such as:

* &#x20;Created time
* Public key
* Machines currently connected using this SSH key

**Delete SSH key:**

You should delete SSH keys if you don't recognize them, if the keys are outdated, or if they may have been compromised.

To delete a key, simply click the **Delete** button next to it.

<figure><img src="https://1913276630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwPjKMG1lirj7mnKwlGT5%2Fuploads%2FME63FCc6xdDykHbSRpLr%2FReview%20SSH%20key_Delete%20key.png?alt=media&#x26;token=656f9d00-5e57-4dab-bc16-588fde65a416" alt=""><figcaption></figcaption></figure>


---

# 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://docs.pictor.network/docs/services/gpu-renting/connection-methods/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.
