If you use ssh alot to log in to a remote server, you can skip typing in the password each time. I use Termux on mobile phone, so less typing is better. A cryptographic key pair is used for authentication where the public key is registered at the remote server once.
You need a cryptographic key on your local machine. Check if you have a public key file such as
.ssh/id_rsa.pub in your home folder.
In Termux you need to install OpenSSH first with:
pkg install openssh
To create a new cryptographic key execute:
ssh-keygen -t rsa -b 4096
Use the default values.
Append the public key content to the remote file
.ssh/authorized_keys with the following command:
cat .ssh/id_rsa.pub | ssh -t firstname.lastname@example.org "cat - >> ./.ssh/authorized_keys"
In Linux you can use
ssh-copy-id which does the same:
ssh-copy-id -i .ssh/id_rsa.pub email@example.com
Now you can login such as
ssh firstname.lastname@example.org without entering a password.
Windows with PuTTY
On Windows with PuTTY you can use the same private key. There is alot more steps involved to do this, open PuTTYgen and
Loadto open the file-dialog
- Show all files
- Select the private key, in our case
id_rsa(not the one showing as Microsoft Publisher Document)
Save private keyand give it a distinct name such as
- Open PuTTY and load your saved sesssion
- Select the
- Save the session and start the session without a password