From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: Remote TCP server through ssh tunnel [Was: Re: Server port] Date: Sun, 24 Oct 2010 17:50:31 -0400 Message-ID: References: <87k4l7mta3.fsf_-_@fulla.xlab.taz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1287957131 28610 80.91.229.12 (24 Oct 2010 21:52:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 24 Oct 2010 21:52:11 +0000 (UTC) Cc: Emacs Developers To: =?iso-8859-1?Q?Llu=EDs?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 24 23:52:09 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PA8U3-0002ho-NM for ged-emacs-devel@m.gmane.org; Sun, 24 Oct 2010 23:52:08 +0200 Original-Received: from localhost ([127.0.0.1]:41762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PA8U2-0002pY-WC for ged-emacs-devel@m.gmane.org; Sun, 24 Oct 2010 17:52:07 -0400 Original-Received: from [140.186.70.92] (port=34675 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PA8Tx-0002oG-Iw for emacs-devel@gnu.org; Sun, 24 Oct 2010 17:52:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PA8Tv-0006HY-RH for emacs-devel@gnu.org; Sun, 24 Oct 2010 17:52:01 -0400 Original-Received: from splat.raeburn.org ([69.25.196.39]:56767 helo=raeburn.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PA8To-0006HK-2H for emacs-devel@gnu.org; Sun, 24 Oct 2010 17:51:59 -0400 Original-Received: from squish.hsd1.ma.comcast.net (c-98-216-239-22.hsd1.ma.comcast.net [98.216.239.22]) by raeburn.org (8.14.3/8.14.1) with ESMTP id o9OLpbWe002648; Sun, 24 Oct 2010 17:51:37 -0400 (EDT) In-Reply-To: <87k4l7mta3.fsf_-_@fulla.xlab.taz> X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132071 Archived-At: On Oct 24, 2010, at 12:48, Llu=EDs 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: >=20 > 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 =20 > server$ ssh -R 13502:localhost:13501 firewall > client$ ssh -L 13501:localhost:13502 vilanova@gso.ac.upc.edu > # 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-Optio= ns.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=