I have been tinkering with my raspberry pi and I haven't been able to solve a problem: Everytime I connect it via ethernet cable to a network, I always have to manually configure its interface configurations (which not only is annoying but also kind of insecure since I have to expose my network password in the .conf file). I do have the settings allowing hot-plug but I don't see any difference.

Is there an interface/wpa_supplicant configuration that allows the raspberry to automatically connect to networks it comes to contact with (just like a regular computer)?

  • Are you looking for a solution in GUI or Command Line? – Tolga Varol Jul 27 '15 at 16:28
  • Command Line would be more efficient, am I correct? @TolgaVarol? Since it's for my individual use, I don't have a problem with cmd solutions. – Maslor Jul 27 '15 at 16:29
  • I think so, in my knowledge there is no such config that will find the ssid itself and add it into /etc/network/interfaces and prompt you to enter the password, but it will be interesting to work on it I'll let you know if I can write a script for that – Tolga Varol Jul 27 '15 at 16:32
  • Indeed, it would be a very useful tool to raspberry pi users! If you don't manage to write a script to automatically do that, I would still appreciate if you could give me some feedback on how your interfaces are configured. Thanks @TolgaVarol – Maslor Jul 27 '15 at 16:41
  • Alright, I've just planned the script and I'll add how it will be done as an answer so that everyone can build their own solution, and after writing the script(hopefully) I'll also add it as an edit. About my interfaces configuration do you want me to copy it to here or do you want something else? – Tolga Varol Jul 27 '15 at 16:44

Since you weren't looking for a Graphical solution and since I couldn't find any other I have written a Bash script for this . It doesn't echo your password when you type it so its kind of secure and it prints all visible networks around you and gives you a chance to choose one.

Then it replaces /etc/network/interfaces with info you enter(SSID and your password) for the wlan0 interface. I didn't add eth0 and a second wlan, wlan1 but by time I think I'll add them and other features such as sorting by quality, channel and other stuff.

Hope this will solve your problem : https://github.com/TolgaV/CLWCA/blob/master/protowca.sh

You just need to make it executable, for that you can use chmod +x protowca.sh or chmod (111 | 333 | 555 | 777) protowca.sh (any one of the numbers in parenthesis).

Then you basically run it by typing : ./protowca.sh

Make sure to back your previous etc/network/interfaces up so that you won't lose it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.