I am working on a project in which the Raspberry Pi kit will be shipped to the customer site. However, I am stuck at the question how to get the kit online, so that it can communicate with the Internet.

Connecting to Wi-Fi is the only option I can see, but the problem is I don't know either SSID or password of the customer's router from the client side. So connecting it to an unsecured Wi-Fi may help. How can I connect a Raspberry Pi to the Wi-Fi network in this case?

Connecting to the Ethernet cable is not possible.

  • You can either get those details at time of sale from the end user and prefill them (not recommended). Alternatively, you can create the config file on the boot partition of the SD card which can be edited from any computer (and include instructions for doing so in your documentation), or roll your own script that gathers that info at first boot and writes it to the proper config files. Mar 12, 2018 at 7:44

3 Answers 3


The way I see this, you have two options:

  1. Require your customer to (initially) hook up the Pi to a HDMI monitor and a USB keyboard. On startup, the Pi will run a script that will gather the necessary information to connect the Pi to their WiFi. Afterwards, they can move the Pi (minus the monitor and keyboard, of course) to the final install location. This is possibly bad for you, as you probably have some kind of case for the Pi.

  2. On startup the Pi will start as a wireless Access Point with a known static IP. The customer will have to connect to this IP (using a laptop) and reconfigure the Pi for their wireless - supply a script that gathers the necessary info, or include clear instructions which files they must edit. Of course, ssh with a known password will have to be enabled to get into the Pi; the user should be forced to change this password.

A place I used to consult for chose option #2. In that case the Pi system also ran a small webserver, and so we had a page where they would supply the WiFi configuration. So no need for ssh with a known password.


To associate with any open access point you only have to create /etc/wpa_supplicant/wpa_supplicant.conf with this content [1]:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


[1] /usr/share/doc/wpasupplicant/examples/wpa-roam.conf

  • I will try this. Mar 12, 2018 at 18:43
  • That won't work unless you are root before. cat | sudo tee /etc/... would be better.
    – jake
    Oct 1, 2019 at 20:06
  • @jake Or use sudo bash -c 'cat > /etc /...'? ;-) I have corrected the answer. Thanks for feedback.
    – Ingo
    Oct 1, 2019 at 22:03
  • @AbhishekBolaj and does it help?
    – Ingo
    Oct 2, 2019 at 8:49
  • Only works if the customer has an open access point. I hope those are few and far between.
    – Bob Brown
    Feb 29, 2020 at 1:05

The Octopi distribution of Raspian Lite which is meant to be an easy way of setting up an Octoprint server for controlling 3d printers requires you to edit a couple of files in the boot partition. They provide explicit instructions on how to do this. Since the boot partition can be read and written by Windows, Linux, and Mac computers, it is easy to find a computer to do this.

They do require that you use, on Windows, a programming editor that understands that "/n" is a newline. They list notepad++ as one of them. There are many free editors that can do this. I would have run a script first that would have fixed the file that Windows could have munged, but that's just my opinion.

The files are octopi-network.txt and optionally creating an empty file called ssh or ssh.txt.

The octopi-network.txt file has everything needed to setup a wireless network and creating one of the ssh files will activate ssh at startup.

I do not think that requiring somebody to have an unlocked WiFi access point is reasonable. It is opening up a large security hole. I also would not give my network information to somebody who wasn't a personal friend.

It would be much more reasonable to allow ethernet access. Almost all wireless routers have ethernet ports, and all technical companies have ethernet wired.

If the Raspberry Pi is installed inside a device, it wouldn't be difficult to put an ethernet port on the outside of the device and run a short connector to the ethernet port of the pi. I did something like that for a robot I built once.

  • Ethernet is the easiest solution. But for my application the electrical device on which my Raspberry kit will be mounted will be mostly used in outdoor. So expecting an Ethernet cable connection ain't an option. Mar 12, 2018 at 18:45
  • But would it be possible to activate it indoors?
    – NomadMaker
    Mar 12, 2018 at 23:02
  • So basically I am creating a sensing device to the capacitors. and it is to reduce the after sales service cost and if every time my engineer has to go there for setup it will not fulfill the purpose. Or it will be a pain for customer to set it up. Mar 15, 2018 at 13:09

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.