TTYD

« tiếng Việt »

updated: 2023-04-24

ttyd is a simple command-line tool for sharing terminal over the web.

It can be used to run a specific TUI software instead of exposing the login screen to your whole computer. In our case, we are serving a XMPP console client.

Install

The quickest and easiest way is to install ttyd is from your distro repo. On Debian, this is as easy as:


    apt install ttyd     

I recommend the newer version from Debian Backports since it has more features.

Launch

You can start ttyd from the command line as soon as you have installed it:


    ttyd -p 7681 profanity

Then point the browser to http://localhost:7681.

You can launch ttyd with more options. To see them all, run:


    ttyd --help     
Configure

Launching ttyd from the command-line however is not stable enough to serve WebCC to the public hence we need to save our configuration to a file. Assumes that our console client will be Profanity, let’s start by creating a configuration directory for webcc:


    mkdir -p /etc/webcc     

For easy access, we can put the help info of ttyd in our configuration file like so:


    ttyd --help 2>&1 | sed -e 's/^/# /' | tee /etc/webcc/profanity.conf     

Then inside the file, add this line at the bottom:

    
    TTYD_OPTIONS="-d7 -i eth0 -p 7681 -m50 -O -b /muc profanity"     

Notice that the option -i above with eth0 will be different for every machine. You can check what you have with:


    ip link     

You should check out the documentaion of ttyd for further details. You can clone the whole wiki to your machine with this:


    git clone https://github.com/tsl0922/ttyd.wiki.git     
Patches

You can modify the source code to add|remove features for your ttyd.

The collection of patches is here.

If you would like to share your patches here, please do contact: xmpp:webcc@hall.trung.fun?join

In the next chapter, we will use this file to launch WebCC with the init system.

«« Console Clients

Init System »»