Raspberry Pi OS Netzwerk über SSh hinzufügen
Erstellt am 06.05.2025 um 19:58:31 Uhr | muellda
Aktualisiert am 06.05.2025 um 19:58:32 Uhr | muellda
sudo sh -c 'wpa_passphrase WiFiSSID WiFiPassword >> /etc/wpa_supplicant/wpa_supplicant.conf'
That will add a new network to the bottom of your supplicant file from the command line.
To configure a Raspberry Pi OS system to connect to a Wi-Fi network and enable SSH access, you can either use the Raspi-config tool or modify the wpa_supplicant.conf
file directly. Alternatively, the Raspberry Pi Imager tool can be used to configure both SSH and Wi-Fi during the initial image writing process.
Using Raspi-config:
- Access Raspi-config: Open the Raspberry Pi configuration tool, either through the GUI (Preferences > Raspberry Pi Configuration) or by using the command
sudo raspi-config
. - Navigate to Network Options: Select “Network Options” and then “Wi-Fi”.
- Configure Wi-Fi: Enter your network’s SSID and password.
- Enable SSH: In Raspi-config, under “Interface Options,” enable SSH to allow remote access.
- Reboot: After making changes, reboot the Raspberry Pi for the new settings to take effect.
Modifying wpa_supplicant.conf
:
- 1. Connect via Ethernet or SSH: If you have a wired connection, connect via Ethernet. Otherwise, connect via SSH to the Raspberry Pi after enabling SSH.
2. Edit the file:
Use a text editor (like nano
) to edit the wpa_supplicant.conf
file: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
.
3. Add Wi-Fi network:
Add a new network entry with your SSID and password. Example: network={ scan_ssid=1 ssid="YourSSID" psk="YourPassword"}
.
4. Save and restart:
Save the changes and restart the networking service with sudo service networking restart
.
Using Raspberry Pi Imager:
- Enable SSH: In Raspberry Pi Imager, navigate to “Advanced Options” and enable SSH.
- Configure Wi-Fi: Select “Configure wireless LAN” and enter your Wi-Fi details.
- Write Image: Write the image to your SD card.
Troubleshooting:
- Incorrect password: Double-check your Wi-Fi password for any typos.
Network issues: Ensure your router is configured correctly and accessible. Reboot: After making changes, always reboot the Raspberry Pi for the new settings to take effect.
Additional Tips:
- Find the IP address: If you’re connecting via SSH, you’ll need the Raspberry Pi’s IP address. You can find this by browsing your router’s settings or using a command like
ip addr show eth0
(if using Ethernet) orip addr show wlan0
(if using Wi-Fi) to display the IP addresses.
Default username and password:
The default username for the Raspberry Pi is “pi” and the default password is “raspberry.” It’s highly recommended to change these for security reasons.
Headless setup:
If you’re setting up the Raspberry Pi headless (without a monitor), you’ll need to use the methods involving the wpa_supplicant.conf
file or using Raspberry Pi Imager to enable SSH and Wi-Fi before the first boot.