Skip to content

Commit 081ed28

Browse files
committed
Update readme file and screenshot
1 parent 79ac4c5 commit 081ed28

File tree

5 files changed

+68
-4
lines changed

5 files changed

+68
-4
lines changed

README.md

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,66 @@ Windows app to configure Raspbian SD card image before first boot
55

66
![Screenshot](/screenshot.png)
77

8-
Setting up Wi-Fi on a Raspberry Pi with a display directly connected is usually easy to do in Raspbian. However, if you want to setup a headless Pi or connect to a university's enterprise network, this requires editing configuration files manually and is less straightforward. This app lets you set up Wi-Fi right after flashing an SD card image for your Pi while the SD card is still in your PC.
8+
Setting up Wi-Fi on a Raspberry Pi with a display connected is usually easy to do in Raspbian. However, if you want to setup a headless Pi or connect to a university's enterprise network, this requires editing configuration files manually and is less straightforward. This app lets you set up Wi-Fi right after flashing an SD card image for your Pi while the SD card is still in your PC.
99

1010
PiBootstrapper can automatically generate the Wi-Fi configuration for both personal and enterprise networks and also enable SSH (Secure Shell) login. After bootstrapping the Pi with this app, it should connect to Wi-Fi right away when it boots and be accessible remotely over the network without any further setup necessary.
1111

12-
This app is written in C# and only runs on Windows, but you can manually configure a headless Pi setup on Linux or Mac. See [here](https://raspberrypi.stackexchange.com/a/57023/42551) for instructions on how to create `wpa_supplicant.conf` and `ssh` files on the SD card boot partition (also [here](https://raspberrypi.stackexchange.com/a/24670/42551) if you need to configure `wpa_supplicant.conf` for an enterprise network). If you want to set up more than just Wi-Fi and SSH on the SD card image, try the cross-platform app [PiBakery](http://www.pibakery.org/) which allows all sorts of customizations.
12+
This app only runs on Windows; follow the instructions below to manually setup a headless Pi on Linux or macOS. If you want to set up more than just Wi-Fi and SSH on the SD card image, try the cross-platform app [PiBakery](https://www.pibakery.org/) which allows all sorts of customizations.
1313

14-
Wi-Fi passwords are hashed by the app before storing them on the Pi rather than being written as plain text, allowing you to safely edit `wpa_supplicant.conf` in public without revealing your password. If you want to manually hash the passwords, you can use the [`wpa_passphrase`](https://linux.die.net/man/8/wpa_passphrase) command for WPA Personal networks, or see [here](https://unix.stackexchange.com/a/278948/190213) for WPA Enterprise networks.
14+
15+
## Manual Instructions
16+
17+
The following instructions explain how to manually configure Wi-Fi and enable SSH on a Raspbian SD card the same way that PiBootstrapper does.
18+
19+
**Warning:** If you have already booted your Pi and connected to Wi-Fi networks, creating a `wpa_supplicant.conf` file on the boot partition will overwrite any existing network configuration the next time it boots. In this case, it is recommended to edit the file `/etc/wpa_supplicant/wpa_supplicant.conf` directly on your Pi (requires *sudo* privileges). You can skip creating a new file at the beginning of the next section and only add the `network={...}` portion to the existing one.
20+
21+
### Configure Wi-Fi
22+
23+
Create a file called `wpa_supplicant.conf` on the SD card boot partition starting with the following lines:
24+
```
25+
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev"
26+
update_config=1
27+
country={COUNTRY_CODE}
28+
29+
```
30+
(Replace `{COUNTRY_CODE}` with your 2 character long ISO country code. A list of them can be found [here](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements), some common ones are "US" for United States and "GB" for United Kingdom.)
31+
32+
After adding the lines shown above, configure your personal or enterprise wireless network as shown in the corresponding section below.
33+
34+
#### WPA/WPA2 Personal
35+
36+
Add the following lines to `wpa_supplicant.conf`:
37+
```
38+
network={
39+
ssid="{NETWORK_NAME}"
40+
scan_ssid=1
41+
key_mgmt=WPA-PSK
42+
psk="{PASSWORD}"
43+
}
44+
```
45+
(Replace `{NETWORK_NAME}` and `{PASSWORD}` with the actual values.)
46+
47+
If you don't want the network password stored in plain text, run the command `wpa_passphrase {NETWORK_NAME} {PASSWORD}` and use the output as the password (without quote marks around it).
48+
49+
#### WPA/WPA2 Enterprise
50+
51+
Add the following lines to `wpa_supplicant.conf`:
52+
```
53+
network={
54+
ssid="{NETWORK_NAME}"
55+
scan_ssid=1
56+
key_mgmt=WPA-EAP
57+
eap=PEAP
58+
identity="{USERNAME}"
59+
password="{PASSWORD}"
60+
phase1="peaplabel=0"
61+
phase2="auth=MSCHAPV2"
62+
}
63+
```
64+
(Replace `{NETWORK_NAME}`, `{USERNAME}`, and `{PASSWORD}` with the actual values.)
65+
66+
If you don't want the network password stored in plain text, run the command `echo -n {PASSWORD} | iconv -t utf16le | openssl md4` and use the output as the password with "hash:" added in front of it (and without quote marks around it). This will not work if the password is more than 14 characters long.
67+
68+
### Enable SSH
69+
70+
Create a blank file with no extension called `ssh` on the SD card boot partition.

screenshot.png

1.18 KB
Loading

src/MainForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private void applyButton_Click(object sender, EventArgs e)
149149
{
150150
string bootDrive = driveComboBox.GetItemText(
151151
driveComboBox.SelectedItem).Split(' ')[0].TrimEnd('\\');
152-
152+
153153
if (!ValidateSettings(bootDrive))
154154
{
155155
return;

src/WpaEnterprise.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public static string GetConfig(string networkName, string username, string passw
5757
{
5858
password = "hash:" + ComputeHash(password);
5959
}
60+
else
61+
{
62+
password = '"' + password.Replace("\"", "\\\"") + '"';
63+
}
6064

6165
string[] config = new string[]
6266
{

src/WpaPersonal.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public static string GetConfig(string networkName, string password, bool shouldE
4141
{
4242
password = ComputeHash(password, networkName);
4343
}
44+
else
45+
{
46+
password = '"' + password.Replace("\"", "\\\"") + '"';
47+
}
4448

4549
string[] config = new string[]
4650
{

0 commit comments

Comments
 (0)