I would like to easily connect my raspberry to any wifi, without keyboard and screen.

I was thinking about create a small script which if no connection available turn on the ad hoc mode and start a http server to display a web page.

I will be able to access this page with my phone or computer and enter the wifi details.

Once new wifi credentials entered the raspberry switch the wifi mode and use the external wifi connection to access internet.

I am only finding heavy configuration to do so.

I tried with:

sudo ifconfig wlan0 down; sudo iwconfig wlan0 mode ad-hoc essid yourEssid
sudo ifconfig wlan0 netmask
sudo ifconfig wlan0 up

But sudo iwconfig wlan0 mode ad-hoc essid yourEssid is returning me an error

Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Device or resource busy.

I do not understand because I am running the down command before

Let me know if you have a better idea to configure the new wifi connection

2 Answers 2


Comitup does pretty much exactly what you want. You can just install it update the config file and be good to go. I’ve been quite happy with it.

If you want more advanced options and even the possibility of AP like functionality then RaspAP may be what your after.

Or if you just want complete overkill. You can always get a USB WiFi card and have it always set to be broadcasting a network. :-)


I found this lib,

It works great https://github.com/Autodrop3d/raspiApWlanScripts

  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Commented Jun 17, 2020 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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