Setup SSH Key Authentication

Background

This tutorial shows how to set up SSH authentication between two Linux servers. This allows for a connection between servers to be done without the use of a password.

Password-less authentication means that automated processes can connect to another server to transfer files or run processes.

Video

If you have comments or questions about the video, please leave them on the video's YouTube page.

The Script

The script below will generate a SSH key. Then you will have copy the public key to the remote server. Afterwards, when connecting to the remote system, you should not have to enter a password.

#!/bin/bash

###############################################################################
# Author: Kenny Robinson, @almostengr
# Video: https://www.youtube.com/watch?v=ZvM-QnQ1zWo
# Description: Generate SSH keys for password-less authentication and more.
###############################################################################

echo "Answer the questions that follow to generate the SSH key"

ssh-keygen -t rsa

echo "Your key has been generated."
Updated: 2023-01-17 | Posted: 2018-04-17
Author: Kenny Robinson