Using the serial port to login is a good way to get access to a device that doesn't have a network connection. This could be a small embedded Linux computer.
enable_uart=1
On a Raspberry Pi you can edit /boot/config.txt and add this at the bottom. Then reboot. More details can be found here.
sudo nano /lib/systemd/system/[email protected]
First we need to edit the serial-getty service to set the correct bard rate.
# Edit this line
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
# To This
ExecStart=-/sbin/agetty 115200 %I $TERM
Set this to the bard rate that you wish to use. This should be the same at the computer is using at the other end.
systemctl daemon-reload
# For a USB serial adaptor
systemctl enable [email protected]
# For a built in serial port /dev/ttyS0
systemctl enable [email protected]
You can now log in using the serial console on /dev/ttyUSB0 or /dev/ttyS0