I have a
raspberry pi 0, but don't have/don't want to connect to a
screen/hdmi/SSH. I can plug my pi's
sdcard into my laptop and access the
raspbian installation files, so is there a way I can instruct my
Raspberry-pi 0 to connect to a specific wifi using a specific password by adding some files to the sdcard/OS on my laptop and make it so when it boots up it connects to that specific wifi?
I have a
The simplest method is to create a file in the boot partition, i.e. the only partition a windows laptop can read anyway, as follows
The filename is
wpa_supplicant.conf and it MUST be in linux end-of-line format (notepad++ lets you do this, recommended)
where xx is your
ISO/IEC alpha2 code "country code" - which, if your profile is correct, would be KR
As opposed to the other answer, no need to "generate the psk" you can simply put the password in quotes instead
On booting, this file will be copied to the correct place and used insteda of whatever is there already
Note: I'm assuming you are running at least raspbian stretch, not sure if earlier raspbian worked like this
Because you don't tell us what operating system do you use on your laptop, here is a bit more generic solution to modify
wpa_supplicant.conf. If you use MS Window$ or Mac OS X you are not able to read the root partition on the SD Card that contains
/etc/wpa_supplicant/wpa_supplicant.conf. But the boot partition (on a running RasPi mounted at
/boot) can be used on most other computer. It is the partition formated as fat32 and contains the kernel and firmware to boot the RasPi. You should find
start.elf and other drivers on it. You can put a file
wpa_supplicant.conf on it. On boot up this file is moved (it disappears) and overwrite
This way you can configure the wifi client as you like, for example with modified or additional network blocks in wpa_supplicant.conf.
assuming your Pi is already correctly set up for networking and wifi, you can modify (or create if not present) a file
/etc/wpa_supplicant/wpa_supplicant.conf with a content like follow:
Where ssid is the SSID (name) of your wifi network and psk is a pre-shared key.
To generate the psk you can use the
wpa_passphrase utility (on any linux computer) like follow:
$ wpa_passphrase yournetwork yournetworkkey
and it will generate the
network block for you that you can add to your config file.