A Note on Using Tmux with SSH

* You are now known as ooupdate * Services.GeekShed.net sets mode +r ooupdate Hi all! Does anyone here use tmux? I'm trying to connect through SSH to a tmux session that was created locally on my system. Oddly, no locally-created tmux session is listed through SSH when I use 'tmux ls', and no tmux session created through SSH is listed on my local machine. Am I missing something basic? ooupdate did you maybe run tmux with sudo? i do that sometimes ooupdate: is tmux set up to receive ssh connections? Firewall config? The current position of Jupiter and Titan? TheAnime: Nope, same user (local and SSH). zell: I didn't know that tmux has to be set up to receive SSH connections -- I'll look into that! ooupdate: Are you trying to get back into the tmux session? Use *tmux attach* to connect back to it. It's weird -- I have one session created through SSH, and one session created locally. 'ps ax | grep tmux' shows both, but 'tmux ls' only shows one on each system. ooupdate: I'm not usre if it does either. I'm trying to set up a server myself and forgot initially to install the ssh server. Might have been a simple oversight. Might have been the whiskey tho.... Crabby: It seems that tmux can't see the sessions -- when I try to attach to them, I'm told that there's no such session. zell: The whiskey both helps and hurts, I'm sure : ) ooupdate: there's no better buzz than the scotch buzz ooupdate: lol yeah. Seriously though. Check the ssh config on the server box and the firewall configs on the client. Might find the culprit there. ooupdate: have you restarted since you detached from your previous sessions? arbulus: Nope, no restarts. 'ps ax | grep tmux' shows all running sessions -- it's just that tmux itself can't see all of them! Odd, right? ooupdate definitely odd, ive never had that pronlem and i run tmux all the time ######################################## NOTE BELOW: ######################################## TheAnime, arbulus, zell: FWIW, I got it, following http://stackoverflow.com/questions/13708376/can-only-connect-to-local-tmux-session-through-over-ssh/13717805#13717805 and http://readystate4.com/2011/01/02/sharing-remote-terminal-session-between-two-users-with-tmux/ -- It turns out that tmux through SSH connections is looking in /run/tmux/[userid], whereas tmux on my local machine is looking in /tmp/tmux-[userid]. So by connecting through SSH and specifying the local machine's socket with 'tmux -S /tmp/tmux-[userid]/default list-sessions', it all works. It also works if I set TMPDIR to /tmp through SSH. Whew! ######################################## # OTHER COMMENTS HERE: ######################################## # You can see where tmux is creating sessions, per the first link above, with `tmux -L temp start\; info | grep path`. Per the link, "This will create a evanescent server using a socket named temp instead of default, and show you the path to the socket it is using." # -S above specifies a socket to attach to. It's easier to just do (assuming `echo $TMPDIR` on the local machine prints '/tmp') `TMPDIR=/tmp; export TMPDIR;`. This can be added to the local machine's ~/.bashrc: `export TMPDIR=/tmp`. ######################################## ooupdate: That is oddly complicated Agreed! It apparently stems from TMPDIR not being set in SSH sessions. I don't know why : / ooupdate: what were you trying to accomplish? ooupdate: Ok, let me get this straight, were you in a local tmux session, and then ssh'd into a remote machine, and then started a tmux session inside that? ooupdate your tmux is weird sm: 1) Start tmux session on local machine (openSUSE 13.1); 2) SSH into local machine from remote machine; 3) Attach to tmux session. TheAnime: Maybe it's an opensuse thing. ooupdate: uhh....'tmux attach' sm: 'tmux attach' only works if tmux sees that there's something to attach to. arbulus: I tried that, to no avail : / tmux is looking in totally different places (/tmp vs /run) on local vs. ssh sm: SSH is using the same user, yeah. DennyTek: I thought so, too, until just now! Yeah, I've never had this problem before. In any case, thanks, all : ) I'm writing this one down and filing it away in case it ever happens again,
Next
Previous