Accessing Raspberry Pi via USB/Ethernet Gadget

A brief note describing how to setup Raspberry Pi Zero as a USB virtual network between Pi and MacBook or PC using USB cable. You can login to Pi using SSH or VNC or copy files using FTP.

No need for keyboard, HDMI cable, screen or mouse. Just the following:

  • Raspbian Image
  • MicroSD card
  • Raspberry Pi Zero
  • MicroUSB cable

Setup notes

  • copy Raspbian Image onto MicroSD card
  • read MicroSD card and open up the boot partition (in Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
  • open up the cmdline.txt. Insert modules-load=dwc2,g_ether after rootwait.
  • create an empty file name ‘ssh’
  • eject the MicroSD card put it in your Raspberry Pi Zero and connect it via USB to your computer.
  • after few minutes, it should then appear as a USB Ethernet device. You can SSH into it using raspberrypi.local as the address.