SSH is a secure method of logging onto a remote computer. If your Pi is networked then this can be a handy way of operating it from another computer or just copying files to or from it.
First you have to install the SSH service. This is done by this command:
sudo apt-get install ssh
After a couple of minutes this will be complete. You can start the daemon (Unix name for a service) with this command from the terminal:
sudo /etc/init.d/ssh start
This init.d is used to start other daemons. For example if you have Apache, MySQL, Samba etc. You can also stop the service with stop or restart it with restart.
Have it Start at Bootup
To set it up so the ssh server starts every time the Pi boots up, run this command once:
sudo update-rc.d ssh defaults
You can check that it worked by forcing your Pi to reboot with the reboot command:
Then after rebooting try to connect to it using Putty or WinSCP (details below).
Note: About powering down/rebooting.
I’ve manage to corrupt my SD card twice through power offs before it had halted. The result: I had to reinstall everything. Only power down once you have fully shut down your Pi. Given it’s low power usage and little heat given off, you could probably leave it running 24×7.
If you want to shut it down, the shutdown command does that:
sudo shutdown -h now
Change -h to -r and it does the same as sudo reboot.
Putty and WinSCP
If you’re accessing your Pi from the command line of a Windows/Linux or Mac PC then use Putty or the commercial (but free for private use) Tunnelier. Both are great for gnerally browsing around your Pi’s folders and copying files to or from a Windows PC. Download them from these urls:
Your Pi needs to be connected to your network before you use Putty or WinSCP and you need to know its ip address. On my network my Pi is on 192.168.1.69. You can find yours by typing in
and on the 2nd line of the output you’ll see inet addr: followed by your ip address.
For Putty, it’s easiest to download putty.exe or the zip file of all the exes and put them in a folder. When you run putty it pops up a configuration Window. Enter your ip address in the input field where it says Host Name (or IP address) and enter pi or any name there.
Now click the save button then the open button at the bottom. You’ll have to login in to your pi but now you can use it as if you were actually there.
This can be quite useful, as it’s far easier to cut and paste long text strings in via a putty terminal.
Try running this command:
That shows a list of processes running in your pi. These include ssh (the two sshd) and Samba (nmbd and smbd) and many others.
|1092||?||Ss||0:00||sshd: pi [priv]|
I find it most useful to set it up in two screen mode rather than in explorer mode but it’s easily changed in the Preferences. Also in preferences under Integration/Applications change the path to the putty.exe so you can easily jump into putty.
When you connect to the pi, it starts at your home directory which is /home/pi. Click on the two .. to view the folder above and do it once more to get to the root. You can see all of the 20 Linux folders.
After you’ve used a terminal for a while you’ll see a hidden file .bash_history (not that well hidden!). This is a text file of your command history with all the commands you’ve used before so copy it, edit out the stuff you don’t want and keep the useful commands somewhere safe.