Skip to content

Instantly share code, notes, and snippets.

@mego22
Last active December 7, 2021 23:28
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mego22/b603b528d436492d90c76b0655a6f9eb to your computer and use it in GitHub Desktop.
Save mego22/b603b528d436492d90c76b0655a6f9eb to your computer and use it in GitHub Desktop.
Tmate-slave on Ubuntu 16.04

Install dependincies

apt-get install  git-core build-essential pkg-config libtool libevent-dev libncurses-dev zlib1g-dev automake libssh-dev cmake ruby

Install msgpack >= 1.2.0

cd /tmp
git clone https://github.com/msgpack/msgpack-c.git
./create_keys.sh
./autogen.sh
./configure

Install newer libssh >= 0.7.0

add-apt-repository ppa:kedazo/libssh-0.7.x
apt-get install libssh-4

Compile tmate-slave

cd /tmp
git clone https://github.com/tmate-io/tmate-slave.git && cd tmate-slave
./create_keys.sh
./autogen.sh && ./configure && make
mv tmate-slave /usr/local/bin/.
mv keys /etc/tmate-slave-keys
/usr/local/bin/tmate-slave -p 2222 -k /etc/tmate-slave-keys

Extras

Setup systemd (/etc/systemd/system/tmate-slave.service)

[Install]
WantedBy=multi-user.target

[Unit]
Description=Tmate-Slave
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
Restart=always
User=root
ExecStart=/usr/local/bin/tmate-slave -p 2222 -k /etc/tmate-slave-keys -h HOST

Enable/Start service

sytemctl daemon-reload
systemctl start tmate-slave
systemctl enable tmate-slave

Add iptables

iptables -I INPUT -p tcp --dport PORT -m state --state NEW,ESTABLISHED -j ACCEPT
@dmerand
Copy link

dmerand commented Nov 3, 2017

Thanks for writing this up! This worked almost perfectly for me on 17.10 as well!

Three things of note:

  1. In dependencies I had to add: sudo apt-get install libmsgpack-dev
  2. The directions for installing msgpack aren't quite right. This worked for me:
cd /tmp
git clone https://github.com/msgpack/msgpack-c.git
cd msgpack-c
cmake .
make
sudo make install
  1. On Ubuntu 17.10 it wasn't necessary to upgrade LibSSH, for whatever that's worth :)

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