Skip to content

Instantly share code, notes, and snippets.

@velizarn
Created April 30, 2020 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velizarn/e63d112509efebd5068aa4444975be98 to your computer and use it in GitHub Desktop.
Save velizarn/e63d112509efebd5068aa4444975be98 to your computer and use it in GitHub Desktop.
Automatically try to connect to a hidden network when WiFi is enabled
#!/bin/sh
#
# Automatically try to connect to "MyNetworkId" when WiFi is enabled
#
# https://askubuntu.com/questions/9014/auto-connect-to-hidden-wireless-without-elevating-privilege
# ...also adjust permissions
# the output of nmcli should be in English
LC_ALL=C
# loop for a while until NetworkManager is accepting commands
while [ "$(nmcli -t -f WIFI,STATE g)" = 'enabled:disconnected' ]
do
nmcli c up id MyNetworkId
sleep 5
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment