Serial on a Raspberry Pi Zero (or any one with an OTG USB port) can be used without
adding the GPIO headers by sending the console down the USB cable itself.
This will present as ttyGS0 on the pi, and ttyACM0 on the host.
First, a bit of sysadmin to enable the console hardware, and load the linux module.
On the host (your laptop), attach a serial console to /dev/ACM0.
$ screen /dev/ttyACM0
Screen will blank the terminal, back on the pi, enable a getty.
$ systemctl enable [email protected]
You now get a terminal on the serial console. If you have a username and passsword
it will work. I typically remove this, and have a shadow like this.
Allow this console to be used for trusted sessions.
$ sudo -e /etc/securetty
# USB OTG Serial (g_serial)
Empty password field means “no login via password, direct login on secure connections” (which is what the securetty controls).
This is safe because you need to be directly attached by the USB cable. If you are this close to the pi, then
you could also backdoor it by swapping out the SD Card.