Linux Administration | ttyd - A better shell in a box 📦

1 min read

The old tool shell in a box is unmaintained and has fallen out of favour.
But we have ttyd.
Install as follows for Linux:
wget https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.i686
sudo mv ttyd.i686 /usr/local/sbin/ttyd
sudo chmod +x /usr/local/sbin/ttyd
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install lrzsz
Next create a service which is only run on the local interface to prevent native access from across a network:
# Create the systemd unit file as follows
sudo nano /etc/systemd/system/ttyd.service
# the ttyd unit file for systemd
[Unit]
Description=ttyd_ComputingforGeeks.com
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/ttyd --writable -i eth0 -t enableZmodem=true login
Restart=always
RestartSec=2
TimeoutStopSec=5
SyslogIdentifier=ttyd
[Install]
WantedBy=multi-user.target
# Activate ttyd service by executing these command seperately and not in the above unit file
sudo systemctl enable ttyd
sudo systemctl start ttyd
To see the status of the service:
sudo service status ttyd
sudo lsof -i -P -n | grep ttyd
Then use secure connect to connect on 10.207.35.254 using port 7681
This provides a shell in a browser tab and includes the ability to transfer files using lrzsz. Neat!
10
Subscribe to my newsletter
Read articles from Ronald Bartels directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ronald Bartels
Ronald Bartels
Driving SD-WAN Adoption in South Africa