I have DietPi running on a Raspberry Pi 3, updated and fully configured, working fine on my local wifi network.
But I need to move it to another place, in another city, where it will be used as a temporary headless server.
In this new place, let’s say, there is no monitor and keyboard available for the Pi. And I need to reconfigure the Pi wi-fi settings for the new place wifi network, with ssid and password that I’ll know only when I come there. But my Windows 10 laptop with a SDcard reader will be available.
Is it possible to change the DietPi wifi settings editing some file on the SDcard with the Windows laptop?
recommended to use notepad++ on a windows machine to modify/tweak those files, otherwise it could cause the carriage returns to not work and thus bork the /boot file
Here is the solution I have found to be able to write to the linux partition of a sd card using a Windows laptop, and edit the interfaces file.
You will need VirtualBox, a laptop with a sd card reader, and a Linux distro installed on VirtualBox. I have used Xubuntu desktop because it’s simple to use and will automount the card partitions.
Open VirtualBox, select the Linux VM, and click on Settings.
Click on “USB” and, on the USB page, click on the icon with a plus symbol, to add a new USB filter.
Select the sd card reader on the list that appears below the add filter icon. In my case it was “Generic Flash Card Reader/Writer (0100)”. Then, click on “Ok”. Now start the virtual machine.
Login on the Linux virtual machine.
Open File Manager.
Now insert the sd card in the laptop sd card reader. After a while all the sd card partitions will automatically be mounted and made available inside the Linux virtual machine. Check on the File Manager the newly mounted partitions.
Edit the the interfaces file for your new network settings. Remember to put the same values on “wireless-essid” and “wpa-ssid”, and on “wireless-key” and “wpa-psk”, if you are using wpa-psk. After editing, use “Ctrl-o”, “Enter”, “ctrl-x”, to save and exit nano.
Original interfaces file: EDIT: REMOVED OBSOLETE LINK
#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.
# Local
auto lo
iface lo inet loopback
# Ethernet
#allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
# Wifi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid FuzonWifi
wireless-key abcde12345
wireless-mode Managed
wireless-power off
wpa-ssid FuzonWifi
wpa-psk abcde12345
#dns-nameservers 8.8.8.8 8.8.4.4
On File Manager, click on the eject icon besides “rootfs”. Remove the sd card from the reader.
Put the sd card on the single-board computer and boot it.
Use ssh to connect to your single-board computer.
If, for some reason, you’ve decided to use DHCP instead of a static IP, you may use Angry IP Scanner on the laptop to try to find the IP issued to the single-board computer.
Ah if running a SSH shell on the Pi and the Pi is up and operational, like Fourdee said…
The interface config file is /etc/network/interfaces as arqeco said
Edit that file with nano or vi of the new remote site SSID and passcode then save normally.
#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.
# Local
auto lo
iface lo inet loopback
# Ethernet
#allow-hotplug eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4
# Wifi
#allow-hotplug wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid FuzonWifi
wireless-key abcde12345
wireless-mode Managed
wireless-power off
wpa-ssid FuzonWifi
wpa-psk abcde12345
#dns-nameservers 8.8.8.8 8.8.4.4
Powerdown, and ship the RPi and card to remote location…fire it up and it should come up as long