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(on Android Phones) 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 phyrum@tea.ch "cat - >> ./.ssh/authorized_keys"
In Linux you can use ssh-copy-id
which does the same:
ssh-copy-id -i .ssh/id_rsa.pub phyrum@tea.ch
Now you can login such as ssh phyrum@tea.ch
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
- Click
Load
to open the file-dialog - Show all files
- Select the private key, in our case
id_rsa
(not the one showing as Microsoft Publisher Document) - Click
Save private key
and give it a distinct name such asputtyprivatekey.ppk
- Open PuTTY and load your saved sesssion
- In
Connection/SSH/Auth/
, clickBrowse...
- Select the
puttyprivatekey.ppk
file - Save the session and start the session without a password