Wednesday, December 11, 2013

headless Raspberry Pi (on my desk)

It's fun to see the Raspberry Pi running headless on my desk.

As described earlier, I set up my Raspi back at home with a screen (connected via HDMI/DVI), a keyboard, a mouse, and attached via eth0 (AKA LAN), later also via wlan0 (AKA wifi).

Now I would like to boot it in "headless mode". My wifi router's ESSID is different here. I start with a LAN connection. It's amazing: I runs w/o my intervention w/o screen, keyboard, and mouse. And I can connect to it with ssh through the network.

So the challenge is to add another wifi access point with its details. I found everything I needed here:
  • I create the new wpa_supplicant.conf entry (on stdout) using the wpa_passphrase command. 
  • I add it to /etc/wpa_supplicant/wpa_supplicant.conf .
  • I add "auto wlan0" to /etc/network/interfaces .
  • After "/etc/init.d/networking restart" or a reboot (w/o a connection through eth0) everything is fine.

Before (and after) modifying configuration files I always create backup copies of them using my utility create_snapshot.sh (resp. create_snapshot.txt). Works on my Linux-s and AIX as well. Initially it was a Korn Shell script, now it's a bash script.

Now the Raspi could join my UMTS router and my NAS sitting in the "black box" below my desk (in the office at my customer's site). Well, if it sits there, it can also be connected via eth0 as well. But now being connected through wifi , it could just sit anywhere within the "realm" of my wifis. But I still enjoy this discreet white box on my desk.

Update:
Added these two lines to my ~/.ssh/config :
Host raspberrypi
    User pi
That allows you to "ssh raspberrypi" instead of "ssh pi@raspberrypi".

Adding your "public key" to ~/.ssh/authorized_keys also helps logging in the "private / public keys way" instead of supplying a password.

No comments: