Here's how to locate your private SSH key on macOS or Linux:
Steps to Find Your Private SSH Key
-
Open Terminal: Launch the Terminal application on your macOS or Linux system. According to the reference, whether you use macOS or Linux, you can open your Terminal application to start.
-
Navigate to the
.ssh
directory: In the Terminal, type the following command and press Enter:cd ~/.ssh/
-
List files: If the
.ssh
folder exists, use thels
command to list the files within it:ls
-
Identify key pair: Look for a pair of files with similar names. The private key will typically be named
id_ed25519
orid_rsa
(without any extension). The corresponding public key will have the same name but with a.pub
extension (e.g.,id_ed25519.pub
orid_rsa.pub
). The reference suggests thatid_ed25519
andid_ed25519.pub
are preferable, butid_rsa
andid_rsa.pub
are also acceptable.File Name Key Type id_ed25519
Private id_ed25519.pub
Public id_rsa
Private id_rsa.pub
Public
Important: Your private key (e.g., id_ed25519
or id_rsa
) is sensitive. Treat it with extreme care and avoid sharing it with anyone. Your public key (e.g., id_ed25519.pub
or id_rsa.pub
) is safe to share.