38

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
    systemctl enable ssh – user3123159 Apr 10 '18 at 13:28
45

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.

  • The officially downloadable Raspbian “wheezy” image starts the sshd per default. – KARASZI István Dec 14 '12 at 19:57
  • 1
    “jessie” does not start sshd anymore by default. – Simon A. Eugster Dec 2 '16 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 '16 at 22:46
  • Thanks for the update – just wanted to add the same link :) – Simon A. Eugster Dec 3 '16 at 21:29
  • Yes! To clarify, /boot refers the partition called boot, no the directory boot in the raspbian ext4 partition – Mikel Mar 8 '17 at 18:53
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
  • /boot is a FAT partition, so almost any OS will automount it. – scruss Aug 30 '12 at 2:37
3

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.

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.

-1

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?

  • 2
    Init is supposed to be a hydra monster ;) – goldilocks Nov 20 '16 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

  • 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 '18 at 7:22

protected by goldilocks Nov 21 '16 at 12:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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