38

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?

  • Hello and welcome. What does the log read after the line you copied? Something about load_hostkeys:? It is possible that login is allowed, but restricted to public-key only and not using passwords. Check /etc/ssh/sshd_config like @fcm's answer suggests. – Ghanima Jan 6 '16 at 22:02
  • It seems that this is not a ssh issue. With the correct adapters I can no test the pi with a screen attached and I can not log in with the known credentials. – Lioman Jan 9 '16 at 9:16
  • This is strange. All documentation leads to the belief that pi/raspberry is the user/pass for jessie lite too. – Ghanima Jan 9 '16 at 11:49
  • 1
    Mea culpa @all! it seems that I mixed up some files or something went wrong with my copy command. I've downloaded it again, pushed it to the card and it works now. Thanks for your hints – Lioman Jan 9 '16 at 17:21
62

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.

  • 13
    Arg, this was my problem. I can't believe there's no mention of this on the image download page. I've flashed cards for my Pi enough times to not need to read the instructions, what a strange thing to "silently" change. – JohnB Dec 6 '16 at 20:44
  • I believe it's been changed since people connected Pis to the outside world without changing the default password. Maybe a better idea would have been a prompt to change it on first login? – Gareth Oakley Dec 7 '16 at 8:37
  • 9
    wow this took me a long time to figure out. fyi if you are using the headless version "SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card." so i just ran cd /Volumes/boot && touch ssh – bitten Feb 15 '17 at 12:06
  • 1
    Thanks for this great tip. It was very disorienting to see Raspbian Jessie Lite work with the May 2016 version and go silent with March 2017 version. – highpost Mar 17 '17 at 7:18
  • 1
    Life saver!! For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card – Steven de Salas May 21 '17 at 8:34
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
  • 1
    The user is using Jessie. This uses systemd to start services. systemctl status ssh.service will show if it is running. – Milliways Jan 6 '16 at 22:39
  • @Milliways, you are right, my bad, I paste from my old notes. However... service is still alive and well. As always, I tried my answer (on Jessie) before posting. – fcm Jan 6 '16 at 22:47
  • 1
    But the OP has trouble connecting user pi not root. So PermitRootLogin should not be of relevance? – Ghanima Jan 6 '16 at 22:54
  • @Ghanima, no, no relevance, then applies just the first part: enable ssh. However, to allow root ssh (without ssh-keygen) is a quite common question. – fcm Jan 6 '16 at 22:59
  • But we're pretty sure sshd is running. Giving permission denied errors. Thus I believe it's something in the sshd_config. – Ghanima Jan 6 '16 at 23:01
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/

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.

0

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

sudo update-rc.d ssh enable

did it for me instantly, without any ssh restart command

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.

  • 2
    Hello and welcome! Please take the tour and visit the helpcenter. Whilst this may theoretically answer the question, it is preferable to include the essential parts of the answer here, and provide the link for reference. In fact we're enforcing this policy: please edit so that the answer stands on its own should the link break in the future. If it is not edited within 48 hours it will be converted to Community Wiki. – Ghanima Jan 26 '17 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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