SSH
SSH, which stands for Secure Shell, is a cryptographic network protocol used for secure communication over an unsecured network. It is commonly used to access and manage remote systems securely.
SSH provides a secure channel over an insecure network by using strong encryption to protect the communication between a client and a server, preventing eavesdropping, connection hijacking, and other attacks.
SSH key
An SSH key is a pair of cryptographic keys used for secure communication between a client and a server using the SSH (Secure Shell) protocol. The two components of an SSH key pair are the private key and the public key.
Using SSH keys for authentication is considered more secure than traditional password-based authentication. The private key acts as a form of digital signature, and even if someone gains access to the public key, they cannot easily derive the corresponding private key.
Let's get down to business
shall we?
Solution
Check your OS (optional)
This step is just to ensure you have Fedora 38 Linux installed. You can pick up one command or you can use them all.
/etc/os-release
cat /etc/os-release
hostnamectl
hostnamectl
Output
When you run hostnamectl
without any options, it provides detailed information about the system's hostname, operating system, kernel, and other system-related settings.
lsb_release
lsb_release -a
Output
lsb_release
is a command-line utility commonly found in Linux distributions that adhere to the Linux Standard Base (LSB). The LSB is a standardization initiative that aims to increase compatibility between different Linux distributions by defining a common set of libraries and conventions.
uname
uname -a
Output
The uname -a
command is used to display detailed system information about the Linux operating system. It provides information about the system's kernel and other system-related details.
Generate the SSH key
ssh-keygen -t ed25519 -C "Elite Bug Hunter Fedora SSH Key" -f ~/.ssh/ebh_fedora_ssh_key
Output
Brief explanation
-t ed25519
: Specifies the type of key to create, in this case, Ed25519.-C "Elite Bug Hunter Fedora SSH Key"
: Adds a comment to the key. Make sure to include the comment in double quotes.-f ~/.ssh/ebh_fedora_ssh_key
: Specifies the filename of the key.
Enter your password
You will be prompted to enter a passphrase. You can either enter a passphrase or press Enter to create the key without a passphrase.
If you want to keep it empty, just press Enter
twice.
Output
Visualize your key
elitebughunter@fedora ~ $ ssh-keygen -t ed25519 -C "Elite Bug Hunter Fedora SSH Key" -f ~/.ssh/ebh_fedora_ssh_key
Generating public/private ed25519 key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/elitebughunter/.ssh/ebh_fedora_ssh_key
Your public key has been saved in /home/elitebughunter/.ssh/ebh_fedora_ssh_key.pub
The key fingerprint is:
SHA256:4/W4zCVzSmzpObHyoejgJgDtthyNKjOAUkTGEudfbqE Elite Bug Hunter Fedora SSH Key
The key's randomart image is:
+--[ED25519 256]--+
|o.+ . F |
|oO * o . |
|Y.X.Y + |
|o%o@ + o . o |
|..= = . S o + . |
| + - * o |
| o . 2 o |
| . . 1 |
| o |
+----[SHA256]-----+
elitebughunter@fedora ~ $
After completing these steps, your new SSH key pair will be generated. The private key will be saved to ~/.ssh/ebh_fedora_ssh_key
and the public key will be saved to ~/.ssh/ebh_fedora_ssh_key.pub
.
Check the keys
ls ~/.ssh/
ls ~/.ssh/ | grep ebh
Output
Done
Celebrate
Let's become friends
Final thoughts
Thank you for reading this article.
If you have any questions, thoughts, suggestions, or corrections, please share them with us.
We appreciate your feedback and look forward to hearing from you.
Feel free to suggest topics for future blog articles. Until next time!