»
2/17/2021

How to setup your own tmate server with docker

tmate is an awesome tool I use to do work/debug session on someone else terminal. Learn more about tmate here. Sadly their default server is not available anymore, at the time of writing this article you have to setup your own tmate server, I could not find a lot of documentation on internet so here we are!

# ssh into your server (e.g. 51.158.172.10)
# install docker
mkdir tmate && cd tmate

# this command will download the create_keys script and create a "keys" folder in the directory
curl -s -q https://raw.githubusercontent.com/tmate-io/tmate-ssh-server/master/create_keys.sh | bash

# don't forget to setup tmate client on the machine you want and configure ~/.tmate.conf with the information outputed by the previous command

# now let's start the server (don't forget to change "sub.my-domain-name.com") with the domain name pointing to your server
# I choose 2223 but any other port will do

docker run -d --name="tmate-server" \
  --cap-add SYS_ADMIN \
  -v  $(pwd)/keys:/keys \
  -e SSH_KEYS_PATH=/keys \
  -p 2223:2223 \
  -e SSH_PORT_LISTEN=2223 \
  -e SSH_HOSTNAME=sub.my-domain-name.com \
  -e USE_PROXY_PROTOCOL=0 \
  tmate/tmate-ssh-server:prod

Now back on your client machines (e.g. personal laptops, or your friend laptop):

# install tmate client (check https://tmate.io/ for instructions)
nano ~/.tmate.conf

# paste what was printed from create_keys.sh

set -g tmate-server-host "IP_OR_DOMAIN_OF_YOUR_SERVER"
set -g tmate-server-port 2223
set -g tmate-server-rsa-fingerprint SHA256:xxxxxxxxxxxxxxxxxx
set -g tmate-server-ed25519-fingerprint SHA256:xxxxxxxxxxxxxxxxxxxxxx

You now are good to go!

»
 
 
Made with on a hot august night from an airplane the 19th of March 2017.