This guide explains how to generate SSH key in Linux. It enhances security by enabling passwordless authentication and encrypting communication between your local machine and remote servers.
To generate an SSH key in Linux, follow these steps:
- Open the terminal on your Linux system.
- Generate the SSH key pair by running the following command:
ssh-keygen -t rsa -b 2048
- This will create a key using the RSA algorithm with a key size of 2048 bits.
- Save the SSH key when prompted. You can press Enter to save the key in the default location (~/.ssh/id_rsa), or specify a different location.
- Set a passphrase for added security when prompted, or leave it blank by pressing Enter.
- Once the process completes, the private and public keys will be stored in the following locations by default:
Private key: ~/.ssh/id_rsa
Public key: ~/.ssh/id_rsa.pub - Copy the public key to the server by running:
ssh-copy-id user@hostname
- Replace user with your username and hostname with the server’s IP address or domain.
- Verify the SSH connection to the server using:
ssh user@hostname
This process confirms secure authentication using SSH keys. If you encounter any issues, feel free to contact our support team. Also, do not hesitate to visit our KB section.