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.

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."
Back to Top