To edit files on a raspberry pi when you are unable to mount ext4 disks, it is possible to enable SSH over USB.
This is also useful if you do not have any peripherals you can attach to the pi.
If however you are running linux you can directly edit /etc/wpa_supplicant/wpa_supplicant.conf
, etc/network/interfaces
and
/etc/dhcpcd.conf
.
There was a security update to the Raspian images.
To enable ssh you need to put a blank ssh
file in the boot directory.
touch /Volumes/boot/ssh
This will write an empty file to the root of your Raspian image. That will enable ssh on startup
In the root folder of the SD card, open config.txt (/Volumes/boot/config.txt) in a text editor
Append this line to the bottom of it:
dtoverlay=dwc2
Save the file
In the root folder of the SD card, open cmdline.txt in a text editor/
After rootwait, append this text leaving only one space between rootwait and the new text (otherwise it might not be parsed correctly):
modules-load=dwc2,g_ether
If there was any text after the new text make sure that there is only one space between that text and the new text
Save the file
edit /etc/wpa_supplicant/wpa_supplicant.conf
and add:
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID"
psk="Password"
}
It is also possible to put a wpa_supplicant.conf
file in the boot directory like ssh
containing the info above.
edit etc/network/interfaces
and add:
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
edit /etc/dhcpcd.conf
and add:
interface wlan0
static ip_address=192.168.0.100 /24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8
edit the ip-address to match your own.
interface = This defines which network interface you are setting the configuration for.
static ip_address = This is the IP address that you want to set your device to. (Make sure you leave the /24 at the end).
static routers = This is the IP address of your gateway (probably the IP address or your router) .
static domain_name_servers = This is the IP address of your DNS (probably the IP address of your router).
You can add multiple IP addresses here separated with a single space.
Remove dtoverlay=dwc2
and modules-load=dwc2,g_ether
from config.txt and cmdline.txt respectively.
You need to do this step to allow SSH over wlan.