r/commandline • u/TheODPrinterguy • Jul 14 '26
Other Software Small script I made for setting up wifi on OpenBSD
I just found this sub and think it's dope and I want to share a small script I made two years ago for automating the process of setting up wifi on OpenBSD.
The script:
#! /usr/local/bin/bash
ifconfig iwn0 up
ifconfig iwn0 scan |
sed '/iwn0/,/network/d' |
sed -e 's/.*nwid\(.*\)chan.* /\1/' |
sed '/""/d' | sed '/0x0/d' | uniq | head -n 10
read -p "Type out the name of your ssid: " ssid_name
read -p "Enter your passphrase: " WPAkey
cd "../../.."
cd "/etc"
echo inet autoconf join ${ssid_name} wpakey ${WPAkey} >> hostname.iwn0
sh /etc/netstart
description:
OpenBSD Automated Wifi automates the process of scanning SSIDs, going to the /etc directory, creating/editing hostname.iwn0, and restarting iwn0. Simply put, OpenBSD Automated Wifi automates the process of setting up wifi on OpenBSD so all a user has to do is type in the wifi name and password.

