Skip to content

Instantly share code, notes, and snippets.

@wwalker
Last active December 7, 2019 19:36
Show Gist options
  • Save wwalker/165776b828f9be646bce4e5f6bc4479a to your computer and use it in GitHub Desktop.
Save wwalker/165776b828f9be646bce4e5f6bc4479a to your computer and use it in GitHub Desktop.
confused ssh tmux interaction
TL;DR - Solved it. $HOSTNAME isn't set in interactive shh session
wwalker@polonium:~ ✓ $ head ~/.tmux.conf
#new -s $HOSTNAME
set-hook -g session-created "rename-session $HOSTNAME"
#rename-session $HOSTNAME
# This works:
wwalker@serenity:~ ✓ $ ssh polonium
Last login: Sat Dec 7 12:20:35 2019 from 172.16.16.119
wwalker@polonium:~ ✓ $ tmux
# tmux opens and if there isn't already a session named polonium the new session is name polonium
# This does NOT work
wwalker@serenity:~ ✓ $ ssh -t polonium tmux
# opens tmux but with this error at the top
# /home/wwalker/.tmux.conf:2: usage: rename-session [-t target-session] new-name [0/0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment