Bernard Joseph Jean Bruno/Quick SSH access to your Linux Without Password

Created Sat, 13 Apr 2019 17:53:46 +0000 Modified Thu, 21 Jan 2021 21:30:48 +0000

Quick SSH access to your Linux Without Password

Quick SSH access to your Linux Without Password

Tired of always typing in your password and ssh @. 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 !