43

I'm following a number of tutorials that explain how to setup an SD card that boots automatically enabling ssh in the process. I'm doing this as I only have a laptop and no spare keyboard, screen, etc. My problem is I cannot find the boot_enable_ssh.rc file.

All of the tutorials I've read describe using dd (so doing this using Unix (Ubuntu)) to write the .img file to the SD card. Done like this:

sudo dd bs=1M if=/path/to/2012-08-16-wheezy-raspbian.img of=/dev/sdb

This completes successfully; the next step is to copy the file

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

boot_enable_ssh.rc is missing.

I've run the dd action using the two most recent image files from the RPi official site - 2012-07-15-wheezy-raspbian.img - 2012-08-16-wheezy-raspbian.img

but for both, there is no /boot/boot_enable_ssh.rc file.

I've also tried searching with find (sudo find /media/ -name boot_enable_ssh.rc). Still with no success.

Am I doing something wrong is there another way to get ssh going?

1
  • 2
    systemctl enable ssh Apr 10, 2018 at 13:28

6 Answers 6

52

Although Raspbian used to enable ssh by default, from December 2016 it no longer does so. While there is still no boot_enable_ssh.rc file as the OP requested in 2012, ssh can be enabled on first boot by creating a file called “ssh” in /boot. As /boot can be written to by any OS that understands SD cards, this extra step is easily done on first installation. It does not need to be done again with the same card image. You can also enable it through raspi-config as before.

The Raspberry Pi Foundation chose to do this as enabling ssh by default and having a well-known user name/password combination is a security risk.

9
  • The officially downloadable Raspbian “wheezy” image starts the sshd per default. Dec 14, 2012 at 19:57
  • 1
    “jessie” does not start sshd anymore by default. Dec 2, 2016 at 21:40
  • 2
    yup, updated my answer to match reality. It did pretty well to be true for more than four years …
    – scruss
    Dec 2, 2016 at 22:46
  • Thanks for the update – just wanted to add the same link :) Dec 3, 2016 at 21:29
  • 1
    in other words to enable it run touch /boot/ssh then reboot your raspberry pi.
    – Tono Nam
    Apr 3, 2018 at 20:38
4

In raspian, if the above suggestions do not work (all though the "mv /boot/boot_enable_ssh.rc /boot/boot.rc" should make it work on the next boot, and there after), the more manual way is to run

sudo raspi-config

and then in the config under advanced options - there is a start ssh option which will start the service.

3

Regardless if ssh is enabled by default in a particular distribution, the:

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

line must be run on the Raspberry Pi for it to work as expected. If you're working from a different computer, you should first mount the SD-card in your filesystem, then operate on .rc files in this mounted card. I don't have access to a proper box now to verify exact commands, but it would look something like:

mkdir ~/sdcard
sudo mount /dev/sdb ~/sdcard
mv ~/sdcard/boot_enable_ssh.rc ~/sdcard/boot/boot.rc
umount ~/sdcard
1
  • /boot is a FAT partition, so almost any OS will automount it.
    – scruss
    Aug 30, 2012 at 2:37
0

For anyone who got a RPi with NOOBS preinstalled on the SD like me and encounters this problem:

SSH seems to be disabled on default with NOOBS. I had to format the SD-card and put the Raspbian image on there before booting up the RPi for the first time.

0

Even though Rasbian uses systemd (A hydra monster of a program that goes against the Unix philosophy of do one thing and do it well.) You can use the "update-rc.d" command to add the System-V style ssh daemon init script to your system startup using the following command:

sudo update-rc.d ssh enable

Clear as mud?

1
  • 2
    Init is supposed to be a hydra monster ;)
    – goldilocks
    Nov 20, 2016 at 21:12
-1

Here's how to do a headless Raspbian install on your Pi. Download Raspbian Image. Head on over here to grab a copy of the Raspbian image. ... Write Image to SD Card. Write the image to SD card. ... Add “SSH” File to the SD Card Root. ... Boot your Pi. ... Find your Pi's IP Address. ... SSH into your Pi. ... Configure your Pi

2
  • Wrong. You should add the empty file 'ssh' (small capitals, not large as you seem to indicate) to the /boot directory (which is on a separate partition).
    – HarryH
    Jun 19, 2018 at 7:22
  • in the year 2k22 its so easy. go to raspberrypi.com/software download the raspberry imager. Format your SD card, start the raspberry imager. Choose your sd and click on the gearwheel in the down right corner. click on "enable ssh" and pick User password authentication. Click Set username and password and set both. Then run the imager. Done :-)
    – Iskandir
    Nov 7, 2022 at 19:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.