SSH Login Without Password Setup Script

SSH Login Without Password Setup Script


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.


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


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.


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



1. Download the script.


2. Make it executable.

chmod +x ssh-auto-login

3. Run the script.


You can view the Gist here.


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