我已经使用 Windows 上的串行端口连接到我的 Ubuntu 盒子(使用腻子连接工作正常。)
根据问题https://serverfault.com/questions/892892/how-to-use-ssh-over-serial-without-using-pppd-or-how-to-transfer-tcp-over-ser,它出现我应该能够通过串行端口通过 SSH 连接到机器。
需要什么包,或者我该如何设置?
http://patrickst.blogspot.com/2011/11/tcpip-over-slip-on-gnulinux-ubuntu.html
https://learn.adafruit.com/welcome-to-circuitpython/advanced-serial-console-on-mac-and-linux
小智 1
SSH 旨在接受通过 TCP/IP 的(安全)连接。要通过串行端口使用 SSH,您需要充当 TCP 客户端并从/向串行端口“转发”数据,例如socat.
这个(源)应该足够了,假设/dev/ttyS1是您的串行端口,115200是所需的波特率(使用 PuTTY 进行串行连接时的“速度”)并且您正在sshd侦听端口22(这是默认值):
socat -d -d tcp:127.0.0.1:22 file:/dev/ttyS1,b115200
Run Code Online (Sandbox Code Playgroud)
-d -d,根据手册:
打印致命、错误、警告和通知消息。
我还没有对此进行测试,因为我目前没有串口。
如果您只需要通过串行端口登录并运行 shell 命令,您可以运行getty,agetty甚至screen在串行端口上运行。SerialConsoleHowto指南已过时,但此答案可能会有所帮助。