Jump to content

[Info] create SSH-Login for a serial device (here Z80-MBC2) using ser2net and a local User


Recommended Posts

The Z80-MBC2 is a 4-chip Z80-computer which can run CP/M and has a 5V TTL-serial-port.
The Z80-MBC2 is powered and accessable via a USB-TTL-serial-adapter (configured to 5V - not 3.3V) type CP2102 seen as /dev/ttyUSB0


The easy way would be to connect the USB-adapter to a Pi-style computer wth armbian, login via SSH and start minicom for the port.

But that way doenst look as good - to me - as the following way ;) 


First we need to install ser2net and telnet (telnet doesnt seem to be installed as standard) in armbian via

apt install ser2net telnet


Then we have to edit /etc/ser2net.conf (delete all lines after the comments and insert these):

BANNER:banner:\r\nser2net port \p device \d [\s] (Debian GNU/Linux)\r\n\r\n
BANNER:z80mbc2:\r\nZ80-MBC2 via Telnet on Port [\p]\r\nDevice connected to         [\d]\r\nConnection Speed            [\s]\r\n

# 2000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner
# 2001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner
# 3000:telnet:600:/dev/ttyS0:19200 8DATABITS NONE 1STOPBIT banner
# 3001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner,2023:telnet:0:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT z80mbc2


Now create a login "shell"/pogram for the new local user z80mbc2 as /usr/local/bin/z80mbc2 :

/usr/bin/telnet 2023

Do a chmod 755  /usr/local/bin/z80mbc2


Now we can create the new local user z80mbc2 as seen on

adduser --shell /usr/local/bin/z80mbc2.sh -q z80mbc2


If you havent done - connect your TTL-USB-Dongle to your SBC - and it should show up as /dev/ttyUSB0 :

[354660.047087] usb 7-1: Product: CP2102 USB to UART Bridge Controller
[354660.047099] usb 7-1: Manufacturer: Silicon Labs
[354660.047109] usb 7-1: SerialNumber: 0001
[354660.112318] usbcore: registered new interface driver usbserial_generic
[354660.112414] usbserial: USB Serial support registered for generic
[354660.131499] usbcore: registered new interface driver cp210x
[354660.131617] usbserial: USB Serial support registered for cp210x
[354660.131902] cp210x 7-1:1.0: cp210x converter detected
[354660.141405] usb 7-1: cp210x converter now attached to ttyUSB0

Now its time to reboot your SBC (I used my NanoPi K1 Plus) via

to automatically let start ser2net-service while booting


Now when you connect to your SBC via SSH and use the z80mbc2 User to login, you should generate a automatic and local ( telnet-login to Port 2023 where /dev/ttyUSB0 a.k.a the Z80-MBC2 device is configured.


PS: other (german) interesting Page about ser2net:






Edited by guidol
added - only localhost - to port 2023
Link to comment
Share on other sites

Donate your old hardware to community. Start a giveaway Raffle!

If you want to use a "real" Terminal - instead of SSH / Ser2Net- like the TTGO VGA32 FabGL ANSI-Terminal and you dont have a 3.3V <-> 5.0V logic level converter available then using the NanoPi K1 Plus (or any other armbian device with 2 USB-ports) as a "mediator" may be possible using the "socat"-command ;) 


To use socat we should disable (disable for every boot or stop until the next boot) the ser2net service:

Usage: /etc/init.d/ser2net {start|stop|restart|reload|force-reload|status}
sudo service ser2net restart
sudo service ser2net stop
sudo service ser2net start

sudo systemctl disable ser2net
sudo systemctl enable ser2net


We do connect 2 USB-TTL-serial-Adapters to the SBC (one for 3.3V TTL-Level and one for 5V TTL-Level).
Via software (socat = apt install socat) we tie them together:

socat /dev/ttyUSB0,raw,echo=0,crnl,b115200 /dev/ttyUSB1,raw,echo=0,crnl,b115200


For the correct backspace-function the FabGL-ANSI-Terminal has to be in "ANSI Legacy"-Mode, because in normal "ANSI"-Mode the backspace-key doenst work right with the output of the Z80-MBC2 ;) 




Link to comment
Share on other sites

On 3/21/2021 at 9:52 AM, guidol said:

Then we have to edit /etc/ser2net.conf 

In the newer version of ser2net (like v4.3.3-1) the /etc/ser2net.conf is replaced

by the /etc/ser2net.yaml which has the yaml-format :(


OK - here is a working version in yaml-format:


# A fully featured configuration file is in
# /usr/share/doc/ser2net/examples/ser2net.yaml

define: &banner \r\nZ80-MBC2 via Telnet on Port [\p]\r\nDevice connected to         [\d]\r\n

connection: &z80mbc2
    accepter: telnet(rfc2217),tcp,2023
    enable: on
      banner: *banner
      kickolduser: true
      telnet-brk-on-sync: true
    connector: serialdev,


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines