Saving your SSH private key

Overview

This article explains how to save the private key you generate in the DreamHost panel in your .ssh folder, protect it, and use it to connect.

When you generate an SSH key in the panel, you can save your private key in two ways:

  • Download Key — Your browser saves the key as a file named id_ed25519.

  • Copy — You paste the key into a text file and save it yourself. Either way, save the key in your .ssh folder so SSH can use it to connect. Your private key is shown only once, so save it before you leave the page.

Already created a key on your computer? See Creating a new Key pair in Windows or Creating a new Key pair in Mac OS X or Linux.

If you already have a file named id_ed25519 in your .ssh folder, don't replace it. That key may give you access to other servers or services. Save the new key with a different name (for example, id_ed25519_dreamhost) and use that name in the steps below.

Creating the .ssh folder

If your computer doesn't have a .ssh folder yet, create it.

macOS and Linux

Open Terminal and run:

[local]$ mkdir -p ~/.ssh && chmod 700 ~/.ssh

Windows

  1. Open File Explorer.

  2. In the address bar, type %USERPROFILE% and press Enter.

  3. If there's no folder named .ssh, create a new folder with that name.

Saving a key you downloaded

If you clicked Download Key, use one of these options to get the key into your .ssh folder.

Moving the key to the .ssh folder

When you click Download Key, your browser saves the key to your Downloads folder. Move it to the .ssh folder.

macOS

  1. Open Finder and go to Downloads.

  2. Open a second Finder window. Press Command + Shift + G, type ~/.ssh, and press Return.

  3. Drag the key file from Downloads into the .ssh window.

  4. Protect the key: right-click the file in .ssh and select Get Info. Under Sharing & Permissions, click the lock to make changes, then set staff and everyoneto No Access. Windows.

  5. Open File Explorer and go to Downloads.

  6. Right-click the key file and select Cut.

  7. In the address bar, type %USERPROFILE%\.ssh and press Enter.

  8. Right-click an empty area and select Paste. Linux.

  9. Open your file manager and go to Downloads.

  10. Right-click the key file and select Cut.

  11. Go to your home folder and press Ctrl + H to show hidden folders. Open .ssh.

  12. Right-click an empty area and select Paste.

  13. Protect the key: right-click the file, select Properties → Permissions, and set Group and Others to None. If you're asked to replace an existing file, click Cancel and see the Important note at the beginning of this article.

Saving the key directly to the .ssh folder

By default, most browsers save files to your Downloads folder without asking. To save your key directly to the .ssh folder, set your browser to ask where to save each file before you click Download Key:

  • Chrome: Select Settings → Downloads, then turn on Ask where to save each file before downloading.

  • Edge: Select Settings → Downloads, then turn on Ask me where to save each file before downloading.

  • Firefox: Select Settings → General → Files and Applications, then select Always ask you where to save files.

  • Safari: Select Settings → General → File download location, then select Ask for each download. Then click Download Key and choose the .ssh folder:

macOS

  1. In the save window, press Command + Shift + G.

  2. Type ~/.ssh and press Return.

  3. Click Save. Windows.

  4. In the save window, go to C:\Users\your-username\.ssh.

  5. Click Save. Linux.

  6. In the save window, press Ctrl + H to show hidden folders.

  7. Open your home folder, then open .ssh.

  8. Click Save.

On macOS and Linux, set the key's permissions afterward. See "Setting the key's permissions on macOS and Linux" below.

Saving a key you copied

If you clicked Copy, paste the key into a plain text file and save it in your .ssh folder. The file name must be id_ed25519 with no extension (not id_ed25519.txt).

macOS

  1. Open TextEdit. Select Format → Make Plain Text.

  2. Paste the key.

  3. Select File → Save. Press Command + Shift + G, type ~/.ssh, and press Return.

  4. In the name field, enter id_ed25519. Uncheck If no extension is provided, use ".txt".

  5. Click Save. Windows.

  6. Open Notepad and paste the key.

  7. Select File → Save As.

  8. In the address bar, type %USERPROFILE%\.ssh and press Enter.

  9. In Save as type, select All files (.).

  10. In the file name field, enter id_ed25519 and click Save. Linux.

  11. Open a text editor and paste the key.

  12. Save the file. In the save window, press Ctrl + H to show hidden folders, then open your home folder and .ssh.

  13. Name the file id_ed25519 and click Save. On macOS and Linux, set the key's permissions afterward. See "Setting the key's permissions on macOS and Linux" below.

Setting the key's permissions on macOS and Linux

SSH won't use a private key that other users on your computer can read. If you didn't already set permissions when you moved the key, open Terminal and run:

[local]$ chmod 600 ~/.ssh/id_ed25519

If you saved the key with a different name, replace id_ed25519 with your file name.

Windows doesn't need this step.

FAQs

Can I view my private key again after I leave the page?

No. The panel shows your private key only once, so save it before you leave the page.

Do I need to set the key's permissions on Windows?

No. Setting permissions is only needed on macOS and Linux.

See also

This form is only for article feedback. If you require assistance, please contact support. Do not include passwords, account numbers, or other private account details.

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?