39

I've installed Raspbian Jessie with dd to my Pi1-B. Everything works fine and I can connect to it via ssh. I do not need any graphical system and want to keep the machine as simple as possible. Therefor I've downloaded and installed Raspbian Jessie Lite. But I cannot get a connection. Error message: Permission denied, please try again. The server is running because it says: debug1: match: OpenSSH_6.7p1 Raspbian-5 pat OpenSSH* compat 0x04000000

Is there any difference between the two images that keeps me from accessing the machine with user pi and password raspberry?

Jacobm001
  • 11,904
  • 7
  • 47
  • 58
Lioman
  • 491
  • 1
  • 4
  • 6

7 Answers7

66

From https://www.raspberrypi.org/documentation/remote-access/ssh/

As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. This is done using raspi-config:

Enter sudo raspi-config in the terminal, first select Interfacing options, then navigate to ssh, press Enter and select Enable or disable ssh server.

For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card.

gregfqt
  • 3
  • 2
Gareth Oakley
  • 761
  • 5
  • 7
3

You may need to enable SSH, however, you are receiving a prompt, so most likely is already active, just in case:

sudo update-rc.d ssh enable

if security is high, edit /etc/ssh/sshd_config

sudo /etc/ssh/sshd_config
# comment
#PermitRootLogin without-password
# and add
PermitRootLogin yes
# and also
#StrictModes yes
StrictModes no

then, restart the ssh service:

sudo invoke-rc.d ssh restart
# or
sudo service ssh restart
fcm
  • 1,869
  • 2
  • 19
  • 30
2

You can enable SSH by placing a file called "ssh" at the root of the boot partition. You would do this right after you flash the image to the SD card and before you place the SD card in the Pi.

  1. ENABLE SSH ON A HEADLESS RASPBERRY PI

For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled, and the file is deleted. The content of the file does not matter: it could contain text, or nothing at all.

Source: https://www.raspberrypi.org/documentation/remote-access/ssh/

Darth Vader
  • 4,218
  • 24
  • 47
  • 70
1

There are no fundamental differences between the configurations. The default password and username are the same.

The error compat 0x04000000 usually indicates that you're having trouble with ssh keys. I would check that you client isn't trying to present a key, and that the permissions on the ~/.ssh/ directory are correctly configured.

Jacobm001
  • 11,904
  • 7
  • 47
  • 58
0

On 2016-03-18-raspian-jessie-lite

sudo update-rc.d ssh enable

did it for me instantly, without any ssh restart command

Ghanima
  • 15,958
  • 17
  • 65
  • 125
0

Had the same problem. Nothing in this post helped me, until I found this lines in my /val/log/auth.log file:

Jun 15 05:43:31 raspberrypi sshd[1551]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key

Jun 15 05:43:31 raspberrypi sshd[1551]: error: key_load_public: invalid format

So found this post on the internet : how-to-fix-regenerate_ssh_host_keys-failed-on-raspbian-for-raspberryp

In short, do the following:

sudo ssh-keygen -t 'rsa' -f /etc/ssh/ssh_host_rsa_key
sudo ssh-keygen -t 'dsa' -f /etc/ssh/ssh_host_dsa_key
sudo ssh-keygen -t 'ecdsa' -f /etc/ssh/ssh_host_ecdsa_key
sudo systemctl restart ssh

This fixed the problem of ssh connection to the rpi for me

-1

For anyone struggling with the SSH option disabled as default, I've found a page that has a list of releases that can get you on your way to starting headless.