Enabling SSH on Debian Raspberry Pi

Debian is the default recommended image for the Raspberry Pi. If you’re using the Raspberry Pi as a server you’ll most likely want to be able to manage it remotely over the network using a local computer and SSH. However, by default SSH isn’t enabled on the Pi. We’ll walk through the basics of getting SSH enabled and logging into the Raspberry Pi over SSH.

The first thing we need to do is log into the Pi normally by plugging in a monitor and keyboard. It also makes sense to plug in the network cable at this point. Once the board boots you get the login screen where the default username is pi and password raspberry.

If you want to change this password you can just type:

passwd

Now we’re going to enable SSH at boot. Luckily there’s a script that enables SSH for us provided so we just need to use the following command to move it to the right location:

sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc

Once we’ve done this rebooting the Raspberry Pi will show something like:

Starting OpenBSD Secure Shell server: sshd

You should now be able to log in via SSH and the same username and password. To find the ip address we need to type:

ip addr

Here we want to look for the ip address on eth0 for example if the output is

1: lo: mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: mtu 1488 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:49:32:63 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.190/24 brd 192.168.1.255 scope global eth0

then our ip address is listed after inet as 192.168.1.190. You could even use ip addr | grep -e 'inet .* eth0' to find just this line.

With this ip address you can now log in using the following credentials:

host: 192.168.1.190 (or whatever your IP was)
username: pi
password: raspberry (or whatever you changed it to)

On a unix based system this will most probably be:

ssh pi@192.168.1.190

From here you can manage the Pi fully over SSH. It’s also possible to remove the password altogether and use a public/private keypair to log in. This is especially recommended if the Pi is going to be publicly available on the internet. In the next post we’ll cover removing the password and just using the keypair.

About these ads

About Steve Smith
Software developer (often ruby, rails but I enjoy loads of languages), semantic tech. fanboy, skydiver, all round geek. Owner of dynamic:edge (hire us) the makers of CloudMailin.com

10 Responses to Enabling SSH on Debian Raspberry Pi

  1. Pingback: Logging into a Rasberry Pi using Public/Private Keys « Steve @ DynamicEdge

  2. Just use: “update-rc.d ssh enable”. That’s the Debian way.

    • Herman says:

      Yes, and does not enable SSH server. Received message “update-rc.d: Using dependency base boot sequencing.
      …inserv:warning:current strt run levels (3 4 5) of script `ssh’ overwrites defaults (2 3 4 5)” Appears changes were made in several different run levels, different from the original startup. Now just where does that leave the startup sequencing?????

  3. Pingback: Raspberry Pi + Symfony2 « HISTORIAS DE UN DÍA DE TRABAJO

  4. Herman says:

    /boot/boot_enable_ssh.rc /boot/boot.rc — These files don’t exist on the 08/16/12 Rasperian image.

  5. Pingback: Enabling SSH on Raspberry Pi and using Putty and WinSCP « Raspberry Pi Adventures

  6. darrall vernon says:

    Hi , Doe’s anybody know of a good text adventure maker ( like infocom ) for raspberry pi ?
    sorry of ive posted in the wrong place !

  7. John says:

    Thank you for a very clear tutorial!

  8. Pingback: Set up a Torrent and Media Server on Raspberry Pi | Todd Pinkerton

  9. Pingback: Eating only half of my Raspberry Pi | function TonyTo85() {

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 361 other followers

%d bloggers like this: