SSH Terminal Issues
Common SSH Terminal Problems
TERM not recognized on remote
# Symptom: "WARNING: terminal is not fully functional"
# or keys/colors broken after SSH
# Cause: remote system lacks terminfo entry for your $TERM
echo $TERM # e.g., "tmux-256color"
# Remote may not have tmux-256color in its terminfo database
# Fix 1: Copy terminfo to remote
infocmp -x | ssh remote 'tic -x /dev/stdin'
# Fix 2: Override TERM
ssh -t remote 'TERM=xterm-256color exec bash'
# Fix 3: Set in SSH config
# Host remote
# SetEnv TERM=xterm-256color
Locale and Encoding
UTF-8 issues over SSH
# Symptom: garbled characters, broken box-drawing
# Check local
locale # should show UTF-8
# Check remote
ssh remote 'locale'
# Fix: set locale on remote
# In remote's ~/.bashrc or ~/.zshrc:
# export LANG=en_US.UTF-8
# export LC_ALL=en_US.UTF-8
# Fix: forward locale (SSH config)
# SendEnv LANG LC_* # in ssh_config
# AcceptEnv LANG LC_* # in remote sshd_config
Broken Pipe and Keepalive
Connection drops
# Symptom: "Write failed: Broken pipe" or frozen terminal
# Client-side keepalive (~/.ssh/config)
# Host *
# ServerAliveInterval 60 # send keepalive every 60s
# ServerAliveCountMax 3 # disconnect after 3 missed
# Server-side (/etc/ssh/sshd_config)
# ClientAliveInterval 60
# ClientAliveCountMax 3
# Escape sequence: unstick frozen SSH
# ~. # disconnect (must be at line start)
# ~? # show escape help
# ~~ # literal tilde
Clipboard Over SSH
OSC 52 clipboard forwarding
# Modern terminals support OSC 52 for remote clipboard
# Copy text to local clipboard from remote
printf "\e]52;c;%s\a" "$(echo -n 'text to copy' | base64)"
# Terminal must support it:
# Alacritty: osc52 = "CopyPaste" in config
# Kitty: clipboard_control write-clipboard
# tmux: set -g set-clipboard on
# Neovim over SSH (uses OSC 52 automatically with recent versions)
# :set clipboard=unnamedplus
Color Issues
Colors broken over SSH
# Symptom: no colors or wrong colors in remote vim/tmux
# Check color support
tput colors # should be 256
# Force 256 colors
export TERM=xterm-256color
# tmux inside SSH: chain correctly
# Local tmux.conf:
# set -g default-terminal "tmux-256color"
# Remote bashrc:
# if [ -n "$TMUX" ]; then export TERM=tmux-256color; fi
# True color test
printf "\e[38;2;255;0;0mRED\e[0m "
printf "\e[38;2;0;255;0mGREEN\e[0m "
printf "\e[38;2;0;0;255mBLUE\e[0m\n"
Resize and Signals
Terminal resize issues
# Symptom: lines wrap wrong, vim draws incorrectly after resize
# Check terminal size
stty size # rows cols
tput lines; tput cols
# Force resize notification
kill -WINCH $$ # send SIGWINCH to current shell
# After serial console or old SSH
stty rows 50 cols 200 # manually set size
resize # auto-detect (xterm)
# Reset broken terminal
reset # full terminal reset
stty sane # reset stty settings
tput reset # terminfo reset