I want to use my RPi 3 completely headless with wifi using Raspbian - I don't have neither a USB keyboard nor a monitor. I modified the following two files on the ext4 partition of my SD card.

The content of /etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

I add the the following lines to /etc/dhcpcd.conf:

interface wlan0
static ip_address=
static routers=
static domain_name_servers=

And finally I added an empty ssh file to the boot partition. I've tried to ping the RPi and it seems to be online:

PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=67.4 ms
64 bytes from icmp_seq=2 ttl=64 time=5.59 ms
64 bytes from icmp_seq=3 ttl=64 time=8.87 ms
64 bytes from icmp_seq=4 ttl=64 time=9.06 ms
64 bytes from icmp_seq=5 ttl=64 time=6.35 ms
64 bytes from icmp_seq=6 ttl=64 time=6.65 ms
--- ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5005ms
rtt min/avg/max/mdev = 5.595/17.337/67.491/22.466 ms

But the command ssh pi@ gives me an error:

ssh: connect to host port 22: Connection refused

Do you have any idea why I can't ssh into my RPi?

  • 1
    Did you enable SSH? It's disabled by default.
    – Jacobm001
    May 15 '17 at 4:32
  • I'm aware of that SSH is disabled by default. I read on many sites that it is possible to enable SSH by creating a file ssh without any file extensions in the boot directory. Is that possible that the SSH is still disabled? May 15 '17 at 8:58
  • Did you really create the ssh file in the boot partition or accidentally in the boot folder on the other partition?
    – Uwe Plonus
    Mar 17 '18 at 20:05

Make fresh raspbian install and make a file called "ssh" without any extensions in the boot directory.

This will fix the rest, since raspbian stretch it is not recommended to edit any network files except the dhcpcd.conf. This does include the wpa_supplicant.conf file.

  • Please differentiate more clearly between a directory and a partition. Placing the file in the /boot directory will not help as during boot the boot partition will be mounted over that.
    – Uwe Plonus
    Mar 17 '18 at 20:08

Yes, it is simply that port 22 is not listening.

First, fix your static IP address in dhcpcd.conf by removing the "/22" - you actually have a "/24" address which means your netmask is

Then go into


and turn on SSH. It will ask you to reboot.

At that point it will allow you to either ssh from another Linux box or use PuTTY.

Tidbit: In your ssh command you can add "pi@" to the IP address if you are already logged in with a different name on your Linux box. If you are already logged in as pi then it is not necessary.

  • If you want to go truly headless, then be sure to sudo apt-get install xrdp - then you will be able to use Remmina (Linux) or Microsoft Remote Desktop (Windows) to get a full GUI interface.
    – SDsolar
    May 14 '17 at 23:11
  • Thank you for the answer! I cannot turn on SSH with rasp-config command, because I don't have a USB keyboard. I read on many sites that it is possible to enable SSH by creating a new file called ssh in the boot partition without any file extension. I removed "\22" from dhcpcd.conf but I still get the same "Connection refused" error message. May 15 '17 at 8:37
  • Good that you removed the /22. Take a look at this and you will see that you really will need a keyboard to accomplish this: roughlea.wordpress.com/raspberry-pi-experiences/…
    – SDsolar
    May 15 '17 at 17:38
  • For what it's worth, I found a link that seems to confirm that "create a file" concept. It needs to be called ssh (lower case) and put into the directory /Volumes/Boot according to this source (which I do not recognize as being authoritative): howchoo.com/g/ote0ywmzywj/… - but I am dubious. I don't find that directory in my system.
    – SDsolar
    May 15 '17 at 21:20
  • Here is an official source, look at section 3.: raspberrypi.org/documentation/remote-access/ssh I've created this "ssh" file in my boot partition, so in theory the SSH should be enabled. On the other hand, according to the link above the file is automatically deleted, when Pi enables the SSH - but I still have this file, which means the Pi didn't find the "ssh" file. Ahh... it seems I really need that USB keyboard. May 16 '17 at 8:17

enter image description here

Give the details of wifi accordingly eject card place in pi and start.

I am using mac here.

Mostly your problem will be ssh file having an extension.

ssh now and try again.

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.