# Generating an SSH Key Pair

### **Linux/MacOS**

1. Open a terminal and use the `ssh-keygen` utility to create your key.\
   For a 2048-bit RSA key:

   ```bash
   bashCopy codessh-keygen -t rsa
   ```

   For increased security, generate a 4096-bit RSA key:

   ```bash
   bashCopy codessh-keygen -t rsa -b 4096
   ```

   *Note:* RSA is recommended over DSA because DSA keys are limited to 1024 bits.
2. When prompted, press **Enter** to use the default location (e.g., `/home/your_username/.ssh/id_rsa` on Linux or `/Users/your_username/.ssh/id_rsa` on Mac), or specify a custom location if needed (e.g., creating a second key).
3. Enter a secure passphrase.
   * This passphrase is required to unlock your private key, adding an extra layer of security.
   * Without a passphrase, someone with your private key could access accounts tied to that key.
4. Confirm your passphrase when prompted.
5. Once complete, `ssh-keygen` will generate:
   * A **private key** (e.g., `id_rsa`) in the specified location.
   * A **public key** (e.g., `id_rsa.pub`) in the same location.
6. To use the public key:
   * For remote access, copy and paste the contents of the public key file into the `~/.ssh/authorized_keys` file on the server.
   * To share with a team, send the **public key** (never share the private key).

***

### **Windows (Using PuTTY)**

1. Download and start the **puttygen.exe** key generator.
2. In the **Key** section, select **SSH-2 RSA**, then click **Generate**.
3. Move your mouse randomly in the small window to generate entropy for the key pair.
4. Add a key comment to identify the key (useful when managing multiple keys).
5. Enter and confirm a passphrase to protect your key.
6. Save your keys:
   * Click **Save private key** to store your private key securely.
   * Click **Save public key** to save your public key.
7. To use the key with PuTTY:
   * Open PuTTY and navigate to **Connection -> SSH -> Auth**.
   * Browse and select your private key file.

***

### **Important Notes**

* Always keep your **private key** secure and never share it.
* Use the **public key** to:
  * Add to `~/.ssh/authorized_keys` for servers you control.
  * Share with teams or projects requiring access.

By following these steps, you ensure secure and efficient SSH access for your use cases.


---

# 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.a-fieldtech.com/a-fieldtech-docs/compute-power/interactive-blocks/generating-an-ssh-key-pair.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.
