The ttyd is a lightweight command-line tool that allows sharing the terminal over the web, making it accessible from any browser. It provides a fast and convenient way to run and interact with shell sessions remotely without requiring additional client software. This tutorial explains how to install ttyd on Ubuntu 24.04.
Install ttyd
Download the latest ttyd binary and save it in the system path:
sudo wget -qO /usr/local/bin/ttyd https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64
Grant execute permissions to the binary:
sudo chmod a+x /usr/local/bin/ttyd
Verify the installation by checking the ttyd version:
ttyd --version
Testing ttyd
Start ttyd with a command that should be shared via the browser. For instance, the top command can be used to present active system processes:
ttyd top
A local web server will be launched, typically listening on port 7681. Open a web browser and navigate to the http://<IP_ADDRESS>:7681 to interact with the running command in real time.
By default, ttyd does not enforce authentication. It can be added using the --credential option, which enables HTTP basic authentication:
ttyd --credential admin:mypass top
With this option enabled, users must provide the specified username and password before accessing the shared session.
Uninstall ttyd
To remove ttyd from the system, delete the installed binary:
sudo rm -rf /usr/local/bin/ttyd
Leave a Comment
Cancel reply