Headless ssh and Wifi on RaspberryPi

in #raspberry6 years ago

SSH:

To enable SSH on a RaspberryPi with out a monitor, keyboard or mouse put your SD-Card in a card reader and plug into your main PC.

Open up a terminal and navigate to the SD Card.

# On Mac:
╭─loki@lokiTheGod ~
╰─$ cd /Volumes
╭─loki@lokiTheGod /Volumes
╰─$ ls
BOOTCAMP MACINTOSH HD Untitled boot

Now you are in the Volumes folder, which shows all drives connected to your mac. You have to create an empty ssh file on the Pi SD-Card.

╭─loki@lokiTheGod /Volumes
╰─$ cd boot
╭─loki@lokiTheGod /Volumes/boot
╰─$ touch ssh

Enter cd boot to go into the Pi SD-Card and then type in touch ssh to create an empty ssh file.

You can verify this by typing ls in your terminal.

WiFi:

Personally this approach didn’t worked for me… so the easiest way to it is via Ethernet.

To enable WiFi directly on your headless Pi place a file name wpa_supplicant.conf in the boot directory of your Pi.

The wpa_supplicant.conf is moved while the Pi starts to /etc/wpa_supplicant/wpa_supplicant.conf where the the wpa configurations are located.

A simple and for most networks sufficient wpa_supplicant.conf looks like this:

WPA:
network={
    ssid="YOUR_SSID"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
}
WPA2:
network={
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_NETWORK_PASSWORD"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}

For more information on this you can look at the Arch Wiki WPA supplicant site (Link).

Have lot of fun with your Pi!

Sort:  

This is actually the first thing any Pi novice should be taught. I only have a laptop and SSH & VNC are the only ways I can access my Pi's. I'm still a novice and this info would've saved me a day of struggle and total loss of unboxing euphoria!

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 60115.56
ETH 3203.28
USDT 1.00
SBD 2.46