An SSH (Secure Shell) Key is a more secure authentication method compared to passwords when accessing a remote server. With an SSH Key, you can log into the server without typing a password every time. This article will guide you through creating an SSH Key on a local PC.
Before starting, make sure you have:
- A PC or laptop with Windows, macOS, or Linux
- Access to a terminal or Command Prompt
- OpenSSH installed on your system (it is available by default on macOS and Linux and can be installed on Windows)
- Open the Terminal or Command Prompt
Enter the following command in the terminal:
ssh-keygen -t rsa -b 4096 -C "email@example.com"
Change “email@example.com” with your main email
Explanation of the command:
- -t rsa: Uses the RSA algorithm
- -b 4096: Sets the key length to 4096 bits (more secure)
- -C "email@example.com": Adds a comment for key identification
After running the command above, you will be asked to specify the storage location. By default, the key will be saved in ~/.ssh/id_rsa. If a key with this name already exists, you can rename it or overwrite it.
You will be prompted to enter a passphrase (an additional password for security). If you do not want to use a passphrase, simply press Enter.
Once the process is complete, two files will be created in ~/.ssh/:
Using an SSH Key enhances security compared to password-based authentication. Be sure to keep your private key safe and only share the public key with the servers you want to access.
Happy coding!

