SSH Login Without Password Setup Script

SSH Login Without Password Setup Script

About

OpenSSH_logoThis is a simple script to allow you to easily setup RSA keys and upload the public key to a remote host for SSH login without requiring a password.

This can also be used to add an extra layer of security to your server by using RSA keys and a password.

Features

  • Setup SSH login without a password using RSA keys
  • Setup SSH login with a password and using RSA keys

Description

I found I kept forgetting how to setup SSH logins using RSA keys so I decided to create simple a script that did it for me.

The script will ask for the remote hostname/IP and username. It will then generate the keys using ssh-keygen (password is optional) ready to be transferred to the remote host.

Next using ssh-copy-id the script will then transfer the key to the remote host when you enter the remote host password. After this you can then login using the without out requiring a password.

Screenshot

I commonly use this with rsync for server backups or file transfers between servers.

ssh-auto-login

Usage

1. Download the script.

wget https://git.io/v54tN

2. Make it executable.

chmod +x ssh-auto-login

3. Run the script.

./ssh-auto-login

You can view the Gist here.

Code

This script uses ssh-keygen and ssh-copy-id.