Creating and Using SSH Key Pairs in Linux

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
Search for a command to run...

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
No comments yet. Be the first to comment.
1. Difference between Docker and Kubernetes Docker → Builds and runs containers.Kubernetes → Orchestrates containers across multiple nodes. Key points: Docker = container runtime. Kubernetes = container orchestration tool. Kubernetes provides auto...
In this session, we learn how to monitor a Kubernetes cluster using Prometheus and Grafana.This is not just theory — there is a GitHub repository containing all installation commands and demo steps.The repo will also be enhanced later with advanced K...
1. What is a ConfigMap in Kubernetes? A ConfigMap is used to store non-sensitive configuration data that your application needs — such as: Database port Connection type Any general configuration values In normal applications (non-Kubernetes), de...
Kubernetes normally supports built-in resources like: Deployment Service Pod ConfigMap Secret Ingress These are called native resources. Sometimes companies (Istio, ArgoCD, Prometheus Operator, Kyverno, etc.) want to add new features that Kub...
1. Why Kubernetes Services Are Needed When a Pod is created in Kubernetes, it receives a dynamic IP address.If the Pod dies and restarts, its IP changes.So other Pods (like checkout → payments) cannot rely on Pod IP because it changes, creating issue...
An SSH key is a cryptographic key used in the Secure Shell (SSH) protocol to establish a secure connection between a client and a server. SSH keys come in pairs:
Public Key: This key can be shared with anyone and is typically added to the ~/.ssh/authorized_keys file on the server you want to access. It allows the server to recognize your client as a trusted user.
Private Key: This key is kept secret and should never be shared. It resides on your client machine and is used to authenticate your identity when connecting to the server.
Security: SSH keys provide a secure method of authentication, eliminating the need for passwords, which can be more vulnerable to interception.
Ease of Use: Once set up, SSH keys allow for passwordless login, making access to remote systems easier and faster.
Encryption: SSH keys help encrypt the data being transferred between the client and server, ensuring privacy and data integrity.
When you try to connect to a server using SSH:
The server sends a challenge to the client.
The client uses its private key to sign the challenge and sends the response back.
The server verifies the response using the corresponding public key. If it matches, the connection is established.
SSH keys are widely used for secure remote logins, secure file transfers, and automating system management tasks.
Step 1: Generate SSH Key Pair
First, generate an SSH key pair on your local machine. This key pair will allow passwordless authentication to the remote server.
ssh-keygen
This will create two files: a private key (~/.ssh/id_rsa) and a public key (~/.ssh/id_rsa.pub).

Step 2: Copy the Public SSH Key
Display the contents of your public SSH key on the local machine:
cat ~/.ssh/id_rsa.pub
This will output your public key. Copy the entire output.

Step 3: Add Your Public Key to the Remote Server
Log in to the remote server and paste the public key into the authorized_keys file:

Make sure to replace "your_public_key_here" with the actual content of your public key.
Step 4: Test the SSH Connection
Try logging back into the remote server from the local machine without entering a password:
ssh user@172.31.13.54
If you successfully log in without a password prompt, your SSH key setup is working.
