SSH into Ubuntu over Serial port

Solution 1:

SSH is meant to accept (secure) connections over TCP/IP. To use SSH over a serial port, you'd need something acting as a TCP client and "forwarding" data from/to the serial port, such as socat.

This (source) should be enough, assuming /dev/ttyS1 is your serial port, 115200 is the desired baud rate ("Speed" when using PuTTY for Serial connection) and you have sshd listening on port 22 (which is the default):

socat -d -d tcp:127.0.0.1:22 file:/dev/ttyS1,b115200

-d -d, according to the manual:

Prints fatal, error, warning, and notice messages.

I have not tested this, as I do not have a serial port at the moment.

If you just need login and run shell commands over the serial port, you can run getty, agetty or even screen on a serial port. The SerialConsoleHowto guide is outdated, but this answer might help.