Tired of always typing in your password and ssh <thing>@<otherthing>. I’ve got a quick fix for you !

Check for existing SSH keys

In case you’ve got another SSH keys, you can check it with this command below:

ls ~/.ssh

If you don’t see a thing, I’ve got your back !

Generate new SSH keys

To generate new SSH keys enter the following command:

ssh-keygen

Copy your public key to your linux remote computer

To copy your public key to your linux machine, use the following command to append the public key to your authorized_keys file, sending it over SSH:

ssh-copy-id <USERNAME>@<IP-ADDRESS>

Then type in your password, and success !

Quick ssh your remote computer.

giphy
It’s not lazy if it’s a command right ?

From time to time you need to access your remote computer with the basic ssh command, but you’ll get a little lazy!

echo "alias <NAME>='ssh <USERNAME>@<IP-ADDRESS>'" >> ~/.bashrc

This will append an alias in your .bashrc. For example, I connect to my raspberry pi.

echo "alias rpi='ssh [email protected]'" >> ~/.bashrc

To load the changes in your current terminal:

source ~/.bashrc

As example to mine, whenever I need to connect to my Raspberry pi, I simply do this:

rpi

I will get connected to my Raspberry Pi quickly and passwordless !