One of the excellent features of the Raspberry Pi (RPi) is that you don’t need to be sat next to it to use it for command line access. This can be useful if you need to update the software on multiple RPi’s at the same time or if you need to store the RPi’s near a router or in a secure cupboard.
Lets look at SSH (Secure Shell) to start with and move on the remote file access later.
The most recent versions of Raspbian (the default operating system of choice) come with SSH access enabled out of the box. So accessing your Raspberry Pi in this way is relatively straight forward. If you are using a Windows computer to access the Raspberry Pi, then you will need a free piece of software called PuTTY.
You can download PuTTY from http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
This will download the main software you need to access your Raspberry Pi via SSH and it does not require any special permissions and does not install anything. When the download has completed you simply run the application and you will launch to the configuration window.
This may look a little daunting to start with, but the basic use is very straight forward so lets go through it in stages.
Host Name (or IP address)
You will need local access to the Raspberry Pi to get this information so, boot up your Raspberry Pi with a screen attached and a keyboard (no mouse is required for this).
Once you are logged in, issue the command: ifconfig
pi@raspberrypi ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:fa:89:86
inet addr:192.168.1.127 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2877788 errors:0 dropped:0 overruns:0 frame:0
TX packets:1883645 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:3357867763 (3.1 GiB) TX bytes:225303669 (214.8 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:302 errors:0 dropped:0 overruns:0 frame:0
TX packets:302 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:23312 (22.7 KiB) TX bytes:23312 (22.7 KiB)
wlan0 Link encap:Ethernet HWaddr 00:0f:13:30:14:49
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
pi@raspberrypi ~ $
The address you are looking for will depend on weather you are using a WiFi connection or a Wired connection. I am using a wired connection so I would use the address under eth0. Wireless users would use wlan0.
So, looking at eth0 I look through and find :
That is the IP address of the Raspberry Pi on my local network. So I would go back to the PuTTy window and enter that address in the Address field:
Now you can Save this to your PuTTY config to save trying to find it each time.
Type a name to save this connection into the first box, then click Save.
Now, we are ready to connect to the Raspberry Pi, so go and click “Open” on that window. You will be warned that this is an unknown connection and it will ask if you want to save the SSH key. Click ok to continue.
Login with your normal Raspberry Pi username (Username : pi and password : raspberry are the default).
You are now connected to your RPi remotely and can do anything you can normally do at the command line.
Try issuing the command:
pi@raspberrypi ~ $ sudo apt-get upgrade
This will upgrade the operating system and any install modules on the RPi.
The “sudo” is just telling the Raspberry Pi to run the command as the high-level user. Without that command, it will fail as as default the user does not have permission to make drastic changes to the Raspberry Pi.
One last note, while connected to a RPi via SSH (or locally) you can SSH from one Raspberry Pi to another:
pi@raspberrypi ~ $ ssh pi@raspberrypi
The authenticity of host 'raspberrypi (127.0.1.1)' can't be established.
ECDSA key fingerprint is 26:78:45:9f:1e:71:00:b0:a1:3f:ba:69:d8:25:04:f7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi' (ECDSA) to the list of known hosts.
Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Sep 14 15:24:57 2013 from vincent-pc
pi@raspberrypi ~ $