On 23/08/12 5:32 AM, Pavlos Parissis wrote:> On 21 August 2012 13:14, Stephen 
Thirlwall <s...@dr.com> wrote:
 >> On 21/08/12 8:10 PM, Nicholas Marriott wrote:
 >>> Hi
 >>>
 >>> You need to ssh back into the server running tmux to run the command.
 >>
 >> Thanks Nicholas.
 >>
 >> Seems so obvious now :)
 >>
 >
 > I am curious to know how you manage it.


In short:
        remote$ ssh local tmux <command>

Works much the same as:
        local$ tmux <command>


You need to be able to ssh from the remote host back to the local (which should 
be
the case unless you're going through a firewall or something, like I am)

It also makes things a lot easier if you've got ssh keys setup in both 
directions,
so you don't need to keep typing passwords in.


Here's a picture of how it works (in my head at least - please correct me here
if I'm wrong)

Local case:
        tmux server <--> local socket <--> tmux command

Remote case:  (<==/thing/==> is a network connection between local & remote 
hosts)
        tmux server <--> local socket <--> tmux command <==/ssh/==> ssh tmux 
command

I'd initially envisioned something much more complicated involving ssh tunnels, 
like:
        tmux server <--> local socket <==/ssh tunnel/==> remote 'mirror' of 
local socket <--> tmux command

(I've no idea if that one above is actually possible/meaningful)


Things get more fun if you want to do something like: tmux split-window "exec 
vim"

The "exec vim" gets called the tmux server on the local machine, so you need to 
do:
        remote$ ssh local tmux split-window "exec ssh -t remote vim"

Which actually does what you expect, with a few minor differences (eg. cwd of 
vim is $HOME)



Steve

ps. also keep in mind what Jim wrote earlier - unless you're calling this stuff 
from a script,
     it's probably much easier to do:
        <tmux-prefix> : command

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to