3

My school's wifi network is not protected merely with a WPA/WPA2 password, it requires authentication (PEAP, MSCHAPv2). I can log into it fine (the credentials are in my network connections) however by default some daemon decides it is better to log into my school's guest account, which can only do http/https protocols and only on the school website. (ie it's useless) It is not a huge bother to simply switch networks after logging in, but it doesn't quite work that way.

Here's how it all goes down. After logging in with my desktop manager, I try using the internet. When it doesn't work, I realize my gnome network applet is set to crappy guest network and so I try to switch to the school network. Once I do this, however, I am informed that I need to enter my gnome-keyring, because it wasn't unlocked when I logged in. I enter my credentials again. By this point my network applet is still set to guest network so I need to switch to the school network once more. Then, finally, it works and I can use the internet normally.

This process is annoying and I would like a shell script to automate it, but since the network can't be logged into with CLI via wpa-supplicant I'm pretty lost as to how it should be written. Here's what I would like the script to do:

0. Iff my school account is detected upon login and my computer is not connected to it, then
1. enter gnome-keyring info to unlock this network
2. Switch to the network

I only want this to run at the beginning of a session so I can change my network manually if I want to. Basically I want the daemon to treat the school network as default if it is up.

What would such a shell script look like?

Network info:

Interface: 802.11 Wifi (wlan0)
Security: WPA/WPA2 Enterprise
Authentication: PEAP (automatic)
Inner authentication: MSCHAPv2 (authenticates me within school database with my school username and password)

Lets call my personal (gnome-key) username "foo" and the password "bar", the school username "uname" and the password "passwd", the network SSID "ssid" and the Device Mac Address "macaddress". Or use your own aliases if they are obvious and/or humorous.

Tell me if you need more info. :) (Running Debian Jessie w/ MATE desktop)

If you have some clue as to how this script should look, any part of it, please post it in the comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.