[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Remote TCP server through ssh tunnel [Was: Re: Server port]
From: |
Ken Raeburn |
Subject: |
Re: Remote TCP server through ssh tunnel [Was: Re: Server port] |
Date: |
Sun, 24 Oct 2010 17:50:31 -0400 |
On Oct 24, 2010, at 12:48, Lluís wrote:
> Which reminds me... can I use emacsclient to connect to a server behind
> a firewall?
This would probably be a more appropriate question for emacs-help, but....
> I've tried with this:
>
> server$ emacs --daemon --eval '(setq server-use-tcp t server-host "0.0.0.0")'
> server$ netstat -nap | grep emacs
> tcp 0 0 0.0.0.0:13501 0.0.0.0:* LISTEN
> 12078/emacs
> server$ ssh -R 13502:localhost:13501 firewall
> client$ ssh -L 13501:localhost:13502 address@hidden
> # I already have an existing tunnel for ssh connections to server
> client$ scp server:.emacs.d/server/server /tmp/server
> client$ sed -i -e s/0.0.0.0/127.0.0.1/ /tmp/server
> client$ emacsclient -f /tmp/server -c
> Waiting for Emacs...
> *ERROR*: Display :0.0 can't be opened
> [Exit 1 ]
":0.0" is the name you generally use for connecting to the local X11 display on
the machine running the X program. That's what you've got on the client, and
what emacsclient passes over to the emacs server process. Unfortunately since
that's running on a different machine, the local X display *there* -- if there
even is one -- is not the one on your client machine.
If your SSH path through is forwarding X11 as well as TCP connections, you need
to find the server-side name for that forwarded "display" and give it to
emacsclient to pass through. I think that'll work; I haven't tried it. (I
usually just run emacsclient on the server machine, over an SSH session, and
let it pop up a window over that same SSH session.)
> client$ emacsclient -f /tmp/server -nw
> *ERROR*: Could not open file: /dev/pts/5
This can't work. Emacs running on the server can't access the local tty device
on your client machine.
> Do you have any clue of why is this happenning? According to the
> documentation, this should work flawlessly (at least with hosts on the
> same network):
>
> http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html
It's a bit misleading, yeah... evaluating an expression or editing a file in
shared NFS space might make sense to trigger remotely like this, and the
documentation was probably fine when multi-tty and daemon support hadn't come
along, but now it probably needs to highlight these problems.
Please file a bug report (M-x report-emacs-bug RET) and/or submit a fix...
(And of course the Emacs driving the new window will be running on the server,
so it can't access files on the client machine without jumping through hoops.
If you really want to be able to do something on the local machine that
triggers editing of files that are on the server machine, you might also look
at the Tramp package, which will let you use your local Emacs, which may be
faster. But if you want to run subprocesses and such over there, or share an
Emacs session there across multiple clients, yeah, getting a window popped up
remotely may be best.)
Ken
- Re: Server port, Leo, 2010/10/23
- Re: Server port, Stefan Monnier, 2010/10/23
- Remote TCP server through ssh tunnel [Was: Re: Server port], Lluís, 2010/10/24
- Re: Remote TCP server through ssh tunnel [Was: Re: Server port],
Ken Raeburn <=
- Re: Remote TCP server through ssh tunnel, Lluís, 2010/10/25
- Re: Remote TCP server through ssh tunnel, Chad Brown, 2010/10/25
- Re: Remote TCP server through ssh tunnel, Stefan Monnier, 2010/10/25
- Message not available
- Re: Remote TCP server through ssh tunnel, Lluís, 2010/10/25
- Re: Remote TCP server through ssh tunnel, Ken Raeburn, 2010/10/26