I recently bought the Pi Zero W and am attempting to run it headless.

I added the wpa_supplicant.conf file + the ssh file to the boot partition on the SD card. Booted the Pi up (with HDMI connected the first time to make sure everything worked). However, when I boot the Pi Zero W, it asks me to type the password before I can even access the terminal.

Also, when I try to SSH in, my Pi is not detected (I included blank SSH file on SD Card too).

Is there a way to enable autologin on the Pi without using HDMI/mouse/keyboard? How can I run the Pi Zero W headless if its going to ask me for a password every time I boot?

  • DO NOT add additional detail in Comments (particularly comments on answers), edit into your question. You have not listed specified any detail (what OS you are using) or any error messages. The error you listed has nothing to do with ssh it is a networking problem.
    – Milliways
    Nov 17, 2017 at 6:16
  • Please note that "solved" should not be edited into the title, you may accept a helpful answer instead.
    – Ghanima
    Nov 17, 2017 at 17:32
  • which is what the last post says..
    – Derek Eden
    Nov 19, 2017 at 23:44

4 Answers 4


The password on the console has nothing to do with SSH. If you're going to run it headless, you don't need autologin (that only applies to the keyboard/monitor).

To enable SSH, do one of the following:

  • sudo touch /boot/ssh and reboot
  • sudo systemctl enable ssh from the running system.
  • sudo raspi-config, then scroll to "interfacing options", then "SSH", then enable the SSH server.
  • thanks for the response..before i booted the first time i created a blank ssh file on the boot partition..can you think of any reason why i could not ssh in once i booted the Pi? i used ssh [email protected] and it says "ssh: Could not resolve hostname raspberrypi.local: nodename nor servname provided, or not known" i included my wifi credentials in the wpa_supplicant file as well :S
    – Derek Eden
    Nov 17, 2017 at 5:56
  • DO NOT do this! Users should either create a ssh file BEFORE boot, OR run raspi-config. DON"T fiddle with systemd.
    – Milliways
    Nov 17, 2017 at 6:20
  • 1
    Make sure the network works first. From the console, can you ping your router or reach services? Does sudo apt update give a nice message about packages being up to date? What does ip address show wlan0 display?
    – BowlOfRed
    Nov 17, 2017 at 6:21
  • 1
    It should be sudo systemctl enable ssh; start will just start it once, not at the next boot. Otherwise there is nothing wrong with that method, it is certainly more canonical and foolproof than the other two.
    – goldilocks
    Nov 17, 2017 at 8:53

To setup auto-login as pi user and with default password as raspberry in Strech,

Type sudo raspi-config

Select Boot Options

Select Desktop/CLI

  • Select Console auto-login for CLI

  • Select Desktop auto-login for GUI


Thanks all for the help..ended up getting it to work..

in short :

had nothing to do with autologin as mentioned aboved..the real issue was my Wifi was not connecting

for some reason, the wpa_supplicant file I created on the boot partition did not copy over to the root partition when I booted.

I just HDMI'd into the PiZeroW and changed the wpa_supplicant file in /etc/ manually and it worked, which probably could have been done on the SD card before hand, but I just don't know how to access the root partition on my Mac because it doesn't allow me to boot it


You may setup a script to run at startup if you are planning to operate pi headlessly. To do this, edit /etc/profile. Each time a login shell is spawned all commands in /etc/profile are executed. sudo nano /etc/profile

To execute a script /home/pi/myscript.sh, add the following line ./home/pi/myscript.sh

Now everytime pi is powered on, it will autologin to pi user and execute your startup script, which presumably will take care of everything you it to do in headless mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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