Advertisement
About80Ninjas

Untitled

Jun 28th, 2025
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # This script prepares a flash drive for a headless Raspberry Pi setup.
  4.  
  5. # --- Configuration ---
  6. # Replace with your desired username
  7. USERNAME="pi"
  8. # Replace with your desired password
  9. PASSWORD="raspberry"
  10. # Replace with your Wi-Fi SSID
  11. WIFI_SSID="YOUR_WIFI_SSID"
  12. # Replace with your Wi-Fi password
  13. WIFI_PASSWORD="YOUR_WIFI_PASSWORD"
  14.  
  15. # --- Script ---
  16.  
  17. # Create userconf.txt for username and password
  18. echo "$USERNAME:$(echo $PASSWORD | openssl passwd -6 -stdin)" > userconf.txt
  19.  
  20. # Create wpa_supplicant.conf for Wi-Fi
  21. cat > wpa_supplicant.conf << EOL
  22. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  23. update_config=1
  24. country=US
  25.  
  26. network={
  27.     ssid="$WIFI_SSID"
  28.     psk="$WIFI_PASSWORD"
  29. }
  30. EOL
  31.  
  32. # Enable SSH
  33. touch ssh
  34.  
  35. echo "Setup complete. Please copy all generated files to the boot partition of your Raspberry Pi's SD card."
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement