czwartek, 27 grudnia 2012

Logging to Raspberry without password

Once upon a time I was spending a lot of time working with Linux servers. It's a distant past, but I still can recall some tips. One of them, quite useful when it comes to playing with RPi, is logging without password. I don't mean to give up passwords and allow anyone to enter my realms, but rather to automate the whole process from trusted machine.

How to achieve that?

On your workstations you need to generate authentication keys:
myuser@myhost:~$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/myuser/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/myuser/.ssh/id_rsa.
Your public key has been saved in /home/myuser/.ssh/id_rsa.pub.
The key fingerprint is:
2d:2c:d5:d1:cc:cc:1a:aa:a3:11:28:da:1b:1a:2a:3a


When you have them, the next step is copying your public key to RPi:
myuser@myhost:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub myuser@raspberrypi
myuser@raspberrypi's password: 
Now try logging into the machine, with "ssh 'myuser@raspberrypi'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

And that's all.
From now on you will be automatically logged to your precious board.

Brak komentarzy:

Prześlij komentarz