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
.sshfolder 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
Open File Explorer.
In the address bar, type
%USERPROFILE%and pressEnter.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
Open Finder and go to Downloads.
Open a second Finder window. Press
Command + Shift + G, type~/.ssh, and pressReturn.Drag the key file from Downloads into the
.sshwindow.Protect the key: right-click the file in
.sshand select Get Info. Under Sharing & Permissions, click the lock to make changes, then setstaffandeveryoneto No Access. Windows.Open File Explorer and go to Downloads.
Right-click the key file and select Cut.
In the address bar, type
%USERPROFILE%\.sshand pressEnter.Right-click an empty area and select Paste. Linux.
Open your file manager and go to Downloads.
Right-click the key file and select Cut.
Go to your home folder and press
Ctrl + Hto show hidden folders. Open.ssh.Right-click an empty area and select Paste.
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
.sshfolder:
macOS
In the save window, press
Command + Shift + G.Type
~/.sshand pressReturn.Click Save. Windows.
In the save window, go to
C:\Users\your-username\.ssh.Click Save. Linux.
In the save window, press
Ctrl + Hto show hidden folders.Open your home folder, then open
.ssh.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
Open TextEdit. Select Format → Make Plain Text.
Paste the key.
Select File → Save. Press
Command + Shift + G, type~/.ssh, and pressReturn.In the name field, enter
id_ed25519. Uncheck If no extension is provided, use ".txt".Click Save. Windows.
Open Notepad and paste the key.
Select File → Save As.
In the address bar, type
%USERPROFILE%\.sshand pressEnter.In Save as type, select All files (.).
In the file name field, enter
id_ed25519and click Save. Linux.Open a text editor and paste the key.
Save the file. In the save window, press
Ctrl + Hto show hidden folders, then open your home folder and.ssh.Name the file
id_ed25519and 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.