Skip to content

Instantly share code, notes, and snippets.

@nhed
Last active April 5, 2017 16:12
Show Gist options
  • Save nhed/020963574b68f7e99e37e4055aa25c02 to your computer and use it in GitHub Desktop.
Save nhed/020963574b68f7e99e37e4055aa25c02 to your computer and use it in GitHub Desktop.

Install any serial prog like picocom

git clone https://github.com/npat-efault/picocom; cd picocom && make

Optional: Manually install in path as above makefile does not have an install rule

Edit sshd_config as follows:

  • make sure port 22 is uncommented & add your new custom port
    Port 22
    Port 3001
    
  • Now force a command this port
    Match LocalPort 3001
      ForceCommand /bin/picocom -b115200 /dev/ttyS8
    

Kermit example with killing existing port user (if any)

create a connection script, not sure if there is a proper place for it, I dropped ine in /etc/kermit/S0.ini

run bash -c '[[ $(lsof -t /dev/ttyS0) =~ .* ]] && kill -9 ${BASH_REMATCH[0]}'
set line  /dev/ttyS0
set baud 115200
set handshake none
set carrier-watch off
set flow-control none
connect
exit

and the sshd_config to match

Match LocalPort 3001
  ForceCommand /usr/bin/kermit /etc/kermit/S0.ini

Credits:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment