By the time I received my RasPi, I didn’t have an usb keyboard yet, so my first concern was about how to use it without the keyboard from the very first boot. It wasn’t clear whether the ssh daemon would be active by default or not, and I’ve also got to know that for some distributions, or even among different updates of the same distribution, its default state changed over time.
I found out that in Raspbian, ssh is installed by default but it’s not configured to start up automatically since the first boot.
Being it a SystemV style OS, I proceeded as follow to enable the ssh daemon at boot.
After plugging the SD card in, and mounting the system partition on the SD card to my Fedora installation, I created the symbolic links for ssh to start at boot time as follows:
# ln -s etc/init.d/ssh etc/rc2.d/S02ssh
and repeated the process for the other runlevels of interest, in my case from 2 to 5.
Now the ssh service would start at boot time and would accept incoming connections.
I could have stopped here with the configuration to be able to access my brand new Pi, but I also wanted to configure the network with a static IP, for my own convenience and ease of NAT rules configuration on the router.
Raspbian comes with the nano text editor, so let’s get into the interface configuration by editing the config file as follows:
# nano etc/network/interfaces
iface eth0 inet dhcp line to
iface eth0 inet static and add the further details:
xxx is the last byte of the local ip of your choice.
Adapt the lines above to your actual network configuration, your router may have a different ip/submask to deal with.
Now it’s time to boot the Pi and connect to it via ssh:
$ ssh email@example.com
or if you need to use graphical applications
$ ssh -X firstname.lastname@example.org
Note that the default pair of user/password for Raspbian is:
Very important note: once you get access to your Pi, do regenerate the SSH keys.
Since Raspbian (and basically all the other distributions) are distributed as prepared images to copy onto the SD card, it is not safe to keep the default SSH keys.
To regenerate the keys proceed as follows:
# rm /etc/ssh/ssh_host_*
# dpkg-reconfigure openssh-server