21

I bought the new Raspberry Pi W but I don't have right now an mini-HDMI adaptor (to connect it to a monitor) neither an Ethernet module to connect by SSH.

Can I connect somehow by SSH through USB?

How can I connect by SSH by WiFi without it being setup? Will the WiFi automatically connect e.g to a wireless network without password?

  • This is a great video in case you're not too tech savvy. youtu.be/xj3MPmJhAPU Check it out if you're stuck. – Alex Garcia Mar 31 '17 at 0:49
  • There are certain complications with Raspberry Pi Headless Setup. Just follow the instruction given in this tutorial. – Vickey Nov 13 '17 at 17:39
20

That's a tough one. The WiFi won't automatically connect. So I would try the following:

  1. Image a micro SD card with the Raspbian OS image using Win32DiskImager.

  2. Manually configure your WiFi from another computer. In another computer running Linux (or PC with Live CD) you could edit the following file:

    /etc/wpa_supplicant/wpa_supplicant.conf

And add the following where you enter your WiFi network SSID and password details:

network={
    ssid="SSID"
    psk="password"
    key_mgmt=WPA-PSK
}
  1. Enable SSH on the Pi from another computer. Create a file on the /boot partition named “ssh”.

Put the SD card on your Pi and if everything works as I hope it would, you'll be able to see the Pi on your WiFi network using your router app and SSH into it. Good luck, hope it helps.

  • Worked for me. See also thecruftofmybrain.com/?p=680 – Mawg Mar 15 '17 at 21:14
  • Thanks for this. What do you do if your wifi is WEP? – Script Kitty Apr 24 '17 at 3:08
  • 3
    @ScriptKitty, upgrade to WPA2. WEP is an open door these days – John La Rooy May 30 '17 at 11:51
  • @John La Rooy I know I've seen people hack really easily. Its not my choice though because it's not my network and done devices cannot connect to the wpa2 – Script Kitty May 30 '17 at 13:35
  • Ubuntu in VirtualBox will work for accessing the Raspbian SD card in an USB card reader. – weberjn Jan 18 '18 at 22:07
15

You are looking for information on running "headless". There are details on this on the raspberry pi site. https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=161202

Basically put a file, wpa_supplicant.conf, on the "boot" sector of the sdcard, that you can see from windows, and edit the file to include your wifi credentials:

network={
       ssid="YourNetworkSSID"
       psk="Your Network's Passphrase"
       key_mgmt=WPA-PSK
    }
7

You can drop in a wpa_supplicant.conf file in the boot directory before installing the SD Card into the Pi. When the Pi boots up, the file /etc/wpa_supplicant/wpa_supplicant.conf will be overwritten (or maybe appended, I'm not sure) with the wpa_supplicant.conf file in the /boot/ directory.

Use the following syntax:

network={
    ssid="YourNetworkSSID-1"
    psk="passwordOne"
}

network={
    ssid="YourNetworkSSID-2"
    psk="passwordTwo"
}

The above setup works for standard WPA wifi connections. There are additional settings in the example below:

network={
        ssid="myssid"
        scan_ssid=1
        psk="incorrect_version_of_mypassword"
        mode=0
        proto=WPA2
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        auth_alg=OPEN
        id_str="raspi"
        priority=5
}

Make sure to create the wpa_supplicant.conf file in a text editor set to UNIX encoding (if you're doing this from Windows).

  • I'm having issue of ssh and wpa_supplicant.conffiles being removed each time my pi zero w boot. That NIX encoding seems help. To be safe, I added the line ctrl_interface, update_config and country line in conf. – checksum Nov 27 '17 at 10:03
6

You can SSH in from USB after some configuration.

This assumes you're not using NOOBS. Doing this with a NOOBS SD card is a little harder and (to my knowledge) impossible on Windows.

  1. First, the Raspberry Pi Foundation disabled SSH as a security precaution, so you'll have to connect the SD card to a computer and put a file called "ssh" (no extension) in the drive labeled "boot" that pops up. (If you're running Windows, only one drive will show up. That one will work.) Now the Pi will enable SSH on boot.
  2. Edit the file config.txt and add dtoverlay=dwc2 on its own line at the end.
  3. Edit the file cmdline.txt and add modules-load=dwc2,g_ether right after it says rootwait. Seperate it from rootwait with a space. Don't add it on a new line, add it on the same line.

When you put the SD card in the Pi and plug it in to your computer (use the left USB port where the USB connectors are on the bottom), it should show up as an ethernet device. You should be able to SSH to pi@raspberypi.local from the attached computer.

Edit: Ricardo's answer reminded me that you could also just do step 1 then see my answer on this related post.

2

You can connect to wifi by creating a wpa_supplicant.conf file in SD Card.

https://www.installvirtual.com/how-to-connect-raspberry-pi-to-wifi-without-a-monitor

You can create an empty ssh file in SD Card to enable ssh while booting.

touch ssh

and insert it in your raspberry pi.

https://www.installvirtual.com/enable-ssh-in-raspberry-pi-without-monitor/

2

Use an awesome app for Mac and maybe windows called PiBakery which is a drag and drop way of setting up Pi zero. That what I did and it really helped. Check it out here: http://www.pibakery.org/

0

If you have windows and don't have access on partition only boot, you can try this • If a wpa_supplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpa_supplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition.

-1

I failed to use the above answers for WPA2.

I used:

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid <ssid here>
wpa-psk <psk here>

in the /etc/network/interfaces file.

https://www.raspberrypi.org/forums/viewtopic.php?t=50312 http://blog.darrenparkinson.uk/2013/10/accessing-raspberry-pi-filesystem-from.html

  • This is not the preferred method of configuring networking on recent versions of Raspbian (jeesie and stretch) evidence of this is the old posts you linked to. – Steve Robillard Oct 22 '17 at 17:49
  • Preferred or not, the preferred version did not work for me. This way did. it's a valid answer despite not being preferred, and some people may find it useful for getting an initial wifi connection that they can then modify to get the preferred version. – Retiarius Oct 22 '17 at 20:02

protected by Community Nov 13 '17 at 18:58

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.