Skip to content

Instantly share code, notes, and snippets.

@AnthonyZJiang
Last active November 23, 2024 19:42
Show Gist options
  • Save AnthonyZJiang/ae3795be1210a6fda0b16d113031e55e to your computer and use it in GitHub Desktop.
Save AnthonyZJiang/ae3795be1210a6fda0b16d113031e55e to your computer and use it in GitHub Desktop.
Linux shell sharing

Tmate

https://tmate.io/

Setup steps

  1. Install tmate on the host machine
  2. Request an API key
  3. Follow instructions on the website to add API key information to .tmate.conf - Be sure to use a difficult session name as it is basically a plaintext password.
  4. Setup system service if the tmate session is to be started automatically as system starts

Setup system service

sudo cat > /etc/systemd/system/tmate.service << 'EOF'
[Install]
WantedBy=multi-user.target

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

[Service]
Type=simple
Restart=always
User={___YOUR_USER_NAME____}
WorkingDirectory=/home/{___YOUR_USER_NAME____}
ExecStart=/usr/bin/tmate -F
EOF

sudo systemctl daemon-reload
sudo systemctl enable tmate
sudo systemctl start tmate

To confirm its working

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