Generate an SSH key and add it to your Runpod account
- Generate an SSH key using this command on your local terminal:
~/.ssh/id_ed25519.pub and ~/.ssh/id_ed25519 respectively.
If you are using Command Prompt on Windows instead of the Linux terminal or WSL, your public and private key pair will be saved to
C:\Users\YOUR_USER_ACCOUNT\.ssh\id_ed25519.pub and C:\Users\YOUR_USER_ACCOUNT\.ssh\id_ed25519, respectively.-
Retrieve your public SSH key by running this command:
This will output something similar to this:
- Copy and paste the output into the SSH Public Keys field in your Runpod user account settings.
If you need to add multiple SSH keys to your Runpod account, make sure that each key pair is on its own line in the SSH Public Keys field.
Override public key for a specific Pod
Runpod will attempt to automatically inject the public SSH keys added in your account settings for authentication when connecting using the basic terminal method. If you prefer to use a different public key for a specific Pod, you can override the default by setting theSSH_PUBLIC_KEY environment variable for that Pod.
Basic SSH connection
All Pods provide a basic SSH connection that is proxied through Runpod’s systems. This method does not support commands like SCP (Secure Copy Protocol) or SFTP (SSH File Transfer Protocol). To connect using this method:- Ensure you have an SSH key pair generated on your local machine and added to your Runpod account.
- Navigate to the Pods page in the Runpod console.
- Expand your Pod and select Connect.
-
Select the SSH tab. Copy the command listed under SSH. It should look something like this:
If you saved your key to a custom location, use that specific path after the
-i flag instead.- Run the copied command in your local terminal to connect to your Pod.
Full SSH connection via public IP
For full SSH capabilities, including SCP and SFTP for file transfers, you need to rent an instance that supports a public IP address and ensure an SSH daemon is running within your Pod. If you’re using a Runpod official template such as Runpod PyTorch or Stable Diffusion, no additional setup is required, as full SSH access is already configured for you. However, if you’re using a custom template, ensure that TCP port 22 is exposed and that the SSH daemon is running inside your Pod. If it isn’t, add the Docker command below to your template (or, if you already have a custom start command, replacesleep infinity at the end of your command with this one):
- Ensure you have an SSH key pair generated on your local machine and added to your Runpod account.
- An SSH daemon must be started in your Pod. Runpod official templates, such as “Runpod PyTorch”, often have this pre-configured. If you’re using a custom template, ensure TCP port 22 is exposed and the SSH daemon is started. Refer to the Use SSH guide for commands to include in your custom Docker template.
- Navigate to the Pods page in the Runpod console.
- Expand your Pod and select Connect.
- Select the SSH tab. Copy the command listed under SSH over exposed TCP. It should look something like this:
If you saved your key to a custom location, use that specific path after the
-i flag instead.- Run the copied command in your local terminal to connect to your Pod.
root: Your assigned username for the Pod (typicallyroot).[POD_IP_ADDRESS]: The public IP address of your Pod.[SSH_PORT]: The designated public SSH port for your Pod.[PATH_TO_SSH_KEY]: The local file path to your private SSH key.
Troubleshooting
If you’re asked for a password when connecting to your Pod via SSH, this means something is not set up correctly. Runpod does not require a password for SSH connections, as authentication is handled entirely through your SSH key pair. This prompt usually indicates a problem with your SSH key configuration. Here are some common reasons why this might happen:- If you copy and paste the key fingerprint (which starts with
SHA256:) into your Runpod user settings instead of the actual public key (the contents of yourid_ed25519.pubfile), authentication will fail. - If you omit the encryption type at the beginning of your public key when pasting it into your Runpod user settings (for example, leaving out
ssh-ed25519), the key will not be recognized. - If you add multiple public keys to your Runpod user settings but do not separate them with a newline, only the first key will work. Each key must be on its own line.
- If you specify the wrong file path to your private key when connecting, SSH will not be able to find the correct key (
No such file or directoryerror). - If your private key file is accessible by other users on your machine, SSH may refuse to use it for security reasons (
bad permissionserror). - If your SSH configuration file (
~/.ssh/config) points to the wrong private key, you will also be prompted for a password. Make sure theIdentityFileentry in your config file matches the private key that corresponds to the public key you added to your Runpod account.