How To Automate Connect, Generate And Add An SSH Key To A Server

Mark Caggiano
3 min readMar 4, 2022

This is probably the last article you will read about connecting, generating and adding ssh keys to a server.

Let’s write a script that will do it for us.

First let’s generate the ssh key. Open a terminal and put this:

$ ssh-keygen -t rsa -b 4096

--

--