> For the complete documentation index, see [llms.txt](https://docs.a-fieldtech.com/a-fieldtech-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.a-fieldtech.com/a-fieldtech-docs/compute-power/interactive-blocks/generating-an-ssh-key-pair.md).

# 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.
