Force Pty Allocation When Spinning Up Tmux Over Ssh

pty
ssh
system manage
terminal
tmux
This article discusses two different approaches to fixing the ‘not a terminal’ error when attaching to a tmux session. Comment A offers alternative command options specific to Kali Linux, while Comment B provides instructions on how to configure the OpenSSH SSH client for pseudo-terminal allocation.
Published

August 13, 2022


kali -t tmux attach -t <target_session_name>

or:

kali -o RequestTTY=no tmux attach -t <target_session_name>

situation:

$ ssh 192.0.2.125 tmux attach
open terminal failed: not a terminal

The solution is to simply force pseudo-terminal allocation.

$ ssh -t 192.0.2.125 tmux attach
[...]

Define RequestTTY in OpenSSH SSH client configuration file to make this permanent.

$ cat ~/.ssh/config
Host 192.0.2.125
RequestTTY yes