Monday 4 November 2013

Raspberry Pi - Second helpings

Gave a talk at the Radio Club - "Raspberry Second Helpings"


This was a follow on talk from my introduction talk, the first Item was how to set you Raspberry Pi to run 'headless'


This involves setting up a static IP Address.



Using your favorite editor, setup the following:   (I use Vi).
edit /etc/network/interface (to match your network settings).
iface eth0 inet static
address 192.168.1.6
netmask 255.255.255.0

gateway 192.168.1.1

You also need to edit /etc/resolv.conf
Add the details for your dns server or your ISPs dns server
nameserver 192.168.1.1

Connect your Raspberry Pi to the Network


Connect the power supply and allow it to boot
Then use an ssh client to connect to your Raspberry pi
(I recommend putty from putty.org)


This will give you cmd line access, however you may want to make it a bit more secure
and easier to use.

Lets make the login secure

Using putty and pageant we will create a public /private key pair and use them to 
login.
Use PuttyGen and create a new pair of keys by clicking the “Generate” button. You can
keep all the options at their default settings. It is be a good idea to set a passphrase for 
your key. Then, save both public and private key to a safe location.
Name your public key .pub and the private key .ppk.

* Pageant / PuttyGen are also from Putty.org

Copy your public key to your /home dir
Then:
ssh-keygen -i -f key.pub >> ~/.ssh/authorized_keys
Replace key.pub with the path to your key. Now log out and setup pageant and restart 
putty.

If you are using a windows PC I recommend WinScp to use to copy your key.


In the picture above you can see your key file.

Problems ? Key Not working ?

Check the permission on the .ssh dir
Only the owner should have rwx
$ chmod 700 .ssh (for example)

Also check the authorized_keys
This should be rw write for the owner only !

This is all well and good but where is the GUI ?

For this we are going to install a VNC Server on the Raspberry Pi.
And a Vnc Client on the Windoze PC ! * not shown !!

Installing VNC on the Pi

Using the cmd line
$ sudo apt-get update
$ sudo apt-get upgrade
(before installing any software and from time to time it’s a good idea to update your o/s).
This can take a while if its not been done for some time.

$ sudo apt-get install tightvncserver
Once installed you need to run
$tightvncserver