How to Generate SSH Keys in Windows and MacOS?
With the help of SSH Key, you can access the command-line interface (CLI) to your web server. Security is one of the major advantages of SSH as it established an encrypted connection from your server to the remote server. Usually, we use a password to connect with SSH, but using an SSH key is way more secure than using a password. If you don’t want to compromise the security and want top-notch security for your server, using an SSH key to connect with the remote server could take a good place. Nowadays, most hosting providers offer pre-installed SSH in their hosting plans, but with limited access. You can purchase Reseller or Dedicated Hosting for “sudo” or “root” access.
Note: This tutorial is for using SSH with root access on a Dedicated Server or VPS hosting. This method won’t work for Shared Hosting or Reseller Hosting users. What you can do is purchase a Dedicated Hosting from us and then follow the further processes.
In this tutorial, we’ll guide you to generate SSH key pairs in various Operating Systems.
Generate SSH Keys In Windows with PowerShell
- First of all, open your Start menu and type PowerShell.
- Move your cursor towards the PowerShell and click the Run as Administrator option.
- Type the below command and hit enter button.
- Type the file name where you want to save the SSH key (For example .ssh).
- Type the secure passphrase (Password) and confirm it by entering again.
- You’ll see a similar command to the following.
SHA256:wYQ+Qn3gmALSMDksk25AQSw/bKL58rCXj3zTFyfXogs delld delldcededd@DESKTOP-0EEKTTB
This is how you can generate SSH keys in Windows with PowerShell.
Make sure your SSH perm SSH bash permissions are correct.
Generate SSH keys in UNIX or macOS Terminal
Follow the below steps to generate SSH keys in Unix or macOS terminal.
- Open Terminal from your application list.
- Once opened, type the following command:
ssh-keygen -t rsa -b 4096
- When you see the “Enter file in which to save the key” prompt, hit the Enter button.
- Type a strong passphrase (Password), and hit Enter.
- You’ll see the below successful message.
userna5@localhost ~ $ ssh-keygen -t rsa -b 4096 Generating public/private rsa key pair. Enter file in which to save the key (/home/userna5/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/userna5/.ssh/id_rsa. Your public key has been saved in /home/userna5/.ssh/id_rsa.pub. The key fingerprint is: SHA256:PRxLu/LU6ZfFDve1sTIR0nK86NJVYRxRONCz0N5oy7U userna5@localhost The key's randomart image is: +---[RSA 4096]----+ | .+.+=| | . *+ | | o oo.*.| | + * ==.o| | S * =o++.| | = =+E=| | . = + .**| | = + oooo| | o ..o | +----[SHA256]-----+
That’s it. I hope this helps you.