- **Epistemic status:** #budding ![[ssh-keygen.svg]] [[SSH]] keys are used for authentication with servers, enabling automation of operations on cloud services and improves security when handled properly. They can be generated on operating systems such as [[Linux]], Mac, and Windows. > Note – For Windows, you can use [Git Bash](https://git-scm.com/) to simplify the process 1. Open your terminal and type or paste the following command and replace the email with yours. ```shell $ ssh-keygen -t ed25519 -C "[email protected]" ``` The command will generate a new pair (public, private) of [[SSH]] keys using the email you entered as the label. ```shell > Generating public/private ed25519 key pair. ``` 2. In the next prompt, you can press enter to save the [[SSH]] key on the default location. You can also type the location and name of the file where you want to save the [[SSH]] key in. ```shell > Enter a file in which to save the key (/home/you/.ssh/id_ed25519): [Press enter] ``` 3. In the last prompt, you can enter a secure passphrase to your new [[SSH]] private key, adding a layer of security. The consequence if your [[SSH]] keys are compromised is that the attacker will have access to all systems that uses those keys. You can [[Add your SSH key to the ssh-agent]] to not have to re-enter the passphrase each time you need to authenticate. You can press enter twice if you don't want to enter a passphrase. ```shell > Enter passphrase (empty for no passphrase): [Type a passphrase] > Enter same passphrase again: [Type passphrase again] ``` --- ## References - GitHub Docs. “Generating a New SSH Key and Adding It to the Ssh-Agent.” Accessed November 22, 2021. <https://docs.github.com/en/[email protected]/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent>. - “Git.” Accessed October 20, 2021. <https://git-scm.com/>. - “Ssh-Agent(1) - Linux Manual Page.” Accessed November 22, 2021. <https://www.man7.org/linux/man-pages/man1/ssh-agent.1.html>. - GitHub Docs. “Working with SSH Key Passphrases.” Accessed November 8, 2021. <https://docs.github.com/en/[email protected]/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases>.