I have a Linux server running on a laptop.I would like it to auto-connect to any open WiFi network automatically. (Without knowing the SSID beforehand)It's for a remote server deployment of ZoneMinder @ a cabin on a large property. If the burglars are REALLY smart they could get on the WiFi and hack the ZoneMinder server, but I highly doubt it and my client aka my parents have the WiFi set to Open.
Auto Connect to any Open WiFi network via CLI Command Line
wifi
To have your computer search and connect to ANY Open Wifi modifiy the following two files:*This was tested on Ubuntu 14.04 x64 Server/etc/network/interfaces##Wireless NICallow-hotplug wlan0iface wlan0 inet manualwpa-roam /etc/wpa_supplicant/wpa_supplicant.confiface open_wifi inet dhcp/etc/wpa_supplicant/wpa_supplicant.confctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdevupdate_config=1##Open_Wifinetwork={    ssid=    key_mgmt=NONE    id_str=open_wifi}Now bring interface down/up and check status.sudo ifconfig wlan0 down && sudo ifconfig wlan0 up && sudo wpa_cli -i wlan0 statusLook forwpa_state=COMPLETEDTesting:use both ifconfig/pingIF ifconfig show's no private IP and ping should faildhclient wlan0try again and should show privateIP and ping should succeed.To manually connect via config for debugging use this:wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext-d = debug/verbose -dd == super verbose-D = driver wext = catch-all driverI tested with phone via hotspot which is PERFECT because it tells you when a client connects. I also turned off HotSpot and it reconnected when it turned back on! Only down side is if you are in a populated area, like my testing environment, it connected to Xfinity-Wifi which is open and then I had to reboot then it seemed to go with my hotspot due to it being a stronger signal. But once it was on XFinity it would not leave it unless I specified the Open Network SSID inside of the wpa_supplicant.conf OR rebooted.