When working with SSH sessions on Ubuntu Server, you might encounter a peculiar situation where your keyboard input isn't displayed in the terminal, yet commands still execute. This typically manifests when:
- Switching between terminal windows
- After periods of inactivity
- When using terminal multiplexers like screen or tmux
The root cause usually relates to TTY (teletype) configuration and terminal echo settings. The terminal stops displaying your input because:
stty -a | grep echo
# Should show "echo" in the output. If not, echo is disabled
Reset terminal settings:
reset
# Or alternatively:
stty sane
Force echo re-enablement:
stty echo
# If that doesn't work, try:
echo -e "\\033c"
SSH client configuration: Add these to your ~/.ssh/config
Host *
ServerAliveInterval 60
TCPKeepAlive yes
EscapeChar none
Server-side TTY fixes:
# Add to /etc/ssh/sshd_config
ClientAliveInterval 60
ClientAliveCountMax 3
For multiplexer-specific issues, try these solutions:
# For screen:
screen -X eval "msgminwait 0" "msgwait 1"
# For tmux:
tmux set-window-option -g automatic-rename off
To inspect current terminal settings:
# Show all terminal settings
stty -a
# Check if input is being processed
cat -v
# Type some characters, should see raw input
Mismatched TERM variables can cause display issues:
# Check current terminal type
echo $TERM
# Set appropriate terminal (usually xterm-256color)
export TERM=xterm-256color
Add these to your shell startup files (~/.bashrc or ~/.zshrc):
# Prevent TTY issues
if [ -n "$SSH_CONNECTION" ]; then
trap 'stty echo' EXIT
stty sane
fi
When working with Ubuntu Server via SSH (from either Putty on Windows or native Linux clients), you might encounter a situation where:
- Input characters stop displaying in terminal after minimizing/restoring window
- Commands still execute normally (e.g., typing "ls" produces directory listing)
- Issue persists across terminal emulators but requires bash restart
This typically occurs due to TTY echo configuration getting corrupted. Several triggers can cause this:
# Check current tty settings (should show "echo" in output)
stty -a | grep echo
# Common causes:
1. Background processes modifying terminal settings
2. Terminal emulator sending incorrect escape sequences
3. Shell configuration files (.bashrc, .profile) with problematic stty commands
Try these before restarting your session:
# Method 1: Reset terminal (most effective)
reset
# Method 2: Manually enable echo
stty echo
# Method 3: Alternative reset method
echo -e "\033c"
SSH Server Configuration
Add these to /etc/ssh/sshd_config:
# Prevent SSH from modifying terminal parameters
PermitUserEnvironment no
UseLogin no
Client-Side Protection
For Putty users:
- Go to Connection → SSH → TTY → TTY modes
- Set "echo" to "Auto"
For Linux/Mac clients:
# Add to ~/.ssh/config
Host *
SendEnv LANG LC_*
ServerAliveInterval 60
EscapeChar none
When using terminal multiplexers:
# For screen users
screen -X eval "echo on"
# For tmux users
tmux set-window-option force-width 80
tmux refresh-client
Create a troubleshooting script named tty_check.sh:
#!/bin/bash
echo "=== TTY Status Check ==="
echo "TTY: $(tty)"
echo "Echo status: $(stty -a | grep echo)"
echo "Terminal type: $TERM"
echo "SSH Client: $SSH_CLIENT"
echo "=== Current Settings ==="
stty -a