Using ssh fingerprint between Raspberry Pi's

If we want several Raspberry Pi to interact with each other, for example to execute remote commands, The most common will be to do it through remote SSH connection. If we want to omit entering the credentials that ssh obliges us to do when making a remote connection, we must create trust between them and not depend on this validation request.

Raspberry-FingerPrint-Bujarra

We will make an example to allow access of the Raspberri Pi 'A’ to the Raspberry Pi 'B'.

 

[SourceCode]pi@A:~$ ssh-keygen -t rsa[/SourceCode]

First, We'll create the authentication keys, We will do it without passphrase, This fingerprint will identify us by means of the unique fingerprint (fingerprint).

 

[SourceCode]pi@A:~$ ssh pi@B mkdir -p .ssh[/SourceCode]

We create the .ssh directory if the remote server does not have it created.

 

[SourceCode]pi@A:~$ cat .ssh/id_rsa.pub | Sh pi@B 'cat >> .ssh/authorized_keys’
pi@A:~$ sudo cat /root/.ssh/id_rsa.pub | Sh pi@B 'cat >> .ssh/authorized_keys'[/SourceCode]

By default ssh saves your public key or fingerprint in the id_rsa.pub file, so we added A's public key to the Raspberry Pi B's allowlist. I also recommend copying the public key from our root in case we execute a command with 'sudo'.

 

[SourceCode]pi@A:~$ ssh pi@B
pi@A:~$ ssh pi@B /home/pi/texto_a_voz.sh "Testing the speaker remotely"[/SourceCode]

And that's it! that easy, We can try connecting with SSH, copy files or run any command!

Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!