I hate the fact that I have to tie up one of my monitors and both of the Rpi’s USB ports for a keyboard and mouse, so I wanted to remote shell into it. While it’s not enabled out of the box, it turns out it’s quite easy to do.
First you have to edit the ethernet interfaces config file. The Pi only has one ethernet port so it’s very simple.
root@raspberrypi:~# sudo vi /etc/network/interfaces
And it should look like this, more or less:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
Comment out the dhcp line and add a new one according to what your network numbers are. I’m at 192.168.xxx.xxx with about five devices getting IPs from my DSL modem. (If you don’t know what I mean here, you probably shouldn’t be doing this)
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.200
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Now edit the name servers, add the google ones, I don’t really know if you need these on a local net but it works for me and they are probably very fast so what the hell, right? Keep your original address, it should be your gateway.
root@raspberrypi:~# sudo vi /etc/resolv.conf
It should look like this before you edit it, or mine did, I’m on a small 192 home network with my dsl modem doing all the dhcp
nameserver 192.168.2.1
Add these two lines to the one already there:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 192.168.2.1
Now start and stop the network:
root@raspberrypi:~# sudo service networking stop
root@raspberrypi:~# sudo service networking start
Enable SSH on startup so you can log into the Pi with Putty. First you will need to generate the certificate, I just hit enter for all the choices since I’m not really all that concerned with security.
ssh-keygen
Now start up the ssh service and set it so it always starts at boot up.
sudo service ssh start
sudo update-rc.d ssh defaults
Now shutdown everything, cycle power and reboot.
root@raspberrypi:~# sudo shutdown -h now
On your PC, if you don’t already have it, install putty, then run it.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Put in the static address of the Pi, in this case it’s 192.168.2.200 and connect. Enter the normal user and password and you are in. You can also now use this with xlaunch to get to the Rpi’s xwindow interface. Although I don’t think I’ll have much use for that personally, it is kinda neat so I’ll post another tutorial for that soon.