Skip to content

Instantly share code, notes, and snippets.

View betoharres's full-sized avatar
🌎

Alberto Harres betoharres

🌎
View GitHub Profile

Generate a new key pair, then add the public key to your ~/.ssh/authorized_keys but with command="/usr/local/bin/tmux a -t pair" before it like below

command="/usr/local/bin/tmux a -t pair" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDMRp0PGmJoycjFN7mJOQx0NcQD76xQrBBAAE6P60tK+3Zvf/gIu/5zvChP05tPT5ecMajxhOKsmtriL5ZRyyzxRja+W3+egZrEPoOAIDxVidX2T1nJpskVAWxqq7G0yueu8n8LrNe8fDUEvOswUzHVnkLp5ybZnQqJkBbZkS/KnQ==

Then you can give the private key to a friend and they'll only be allowed to connect when you have started a new tmux session with: tmux new-session -s pair