Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

emacsclient over ssh

823 views
Skip to first unread message

Harry Putnam

unread,
Jun 23, 2009, 5:39:33 PM6/23/09
to help-gn...@gnu.org
Can I get some guidance on this:

I want to run emacsclient on localhost but connect to emacs-server
running running on remotehost.

is there syntax for the emacsclient -s flag to go thru ssh to the
remote emacs-server

maybe something like emacsclient -s host:server -c

If this is the wrong way to go maybe someone can tell me how its done.
So far I've just been doing ssh user@host
Then run emacsclient on the remote... but of course I'm then limited
to a console emacs.

ssh to linux from opensolaris and then running emacs has a number of
problems that need solving for that to be handy. I guess having to do
with what shell you are in and `stty' setting and other things I haven't
thought of.

At any rate a console emacs arrived at that way is a pain in the but
to use. Its fine for normal file/directory work... but I want to
access an emacs/gnus session running on the remote emacs-server. And I
want the emacsclient to run in X on the localhost.

Both remote and localhost are running X.

The end result I'm after is to be able to access an emacs/gnus session
that is running on a specific host from any of several hosts on the
home lan.

Someway... I want to end up with an emacsclient running in X and
connected to a server on remotehost.

Richard Riley

unread,
Jun 23, 2009, 6:09:38 PM6/23/09
to
Harry Putnam <rea...@newsguy.com> writes:

> Can I get some guidance on this:
>
> I want to run emacsclient on localhost but connect to emacs-server
> running running on remotehost.
>
> is there syntax for the emacsclient -s flag to go thru ssh to the
> remote emacs-server
>
> maybe something like emacsclient -s host:server -c
>
> If this is the wrong way to go maybe someone can tell me how its done.
> So far I've just been doing ssh user@host
> Then run emacsclient on the remote... but of course I'm then limited
> to a console emacs.

Possibly just enable x forwarding? Google will help with that. Probably
something like /etc/ssh/sshd_config and

"X11Forwarding yes"

Then if you have the server running on hermes for example your
command could be I guess:

ssh hermes 'emacsclient -c filename'

>
> ssh to linux from opensolaris and then running emacs has a number of
> problems that need solving for that to be handy. I guess having to do
> with what shell you are in and `stty' setting and other things I haven't
> thought of.
>
> At any rate a console emacs arrived at that way is a pain in the but
> to use. Its fine for normal file/directory work... but I want to
> access an emacs/gnus session running on the remote emacs-server. And I
> want the emacsclient to run in X on the localhost.
>
> Both remote and localhost are running X.
>
> The end result I'm after is to be able to access an emacs/gnus session
> that is running on a specific host from any of several hosts on the
> home lan.
>
> Someway... I want to end up with an emacsclient running in X and
> connected to a server on remotehost.
>
>
>

--

suvayu ali

unread,
Jun 23, 2009, 7:13:03 PM6/23/09
to help-gn...@gnu.org
2009/6/23 Richard Riley <riley...@gmail.com>:

> Harry Putnam <rea...@newsguy.com> writes:
>
>> Can I get some guidance on this:
>>
>> I want to run emacsclient on localhost but connect to emacs-server
>> running running on remotehost.
>>
>> is there syntax for the emacsclient -s flag to go thru ssh to the
>> remote emacs-server
>>
>>   maybe something like emacsclient -s host:server -c
>>
>> If this is the wrong way to go maybe someone can tell me how its done.
>> So far I've just been doing ssh user@host
>> Then run emacsclient on the remote... but of course I'm then limited
>> to a console emacs.
>
> Possibly just enable x forwarding? Google will help with that. Probably
> something like /etc/ssh/sshd_config and
>
> "X11Forwarding yes"
>
> Then if you have the server running on hermes for example your
> command could be I guess:
>
> ssh hermes 'emacsclient -c filename'
>

use 'ssh -Y' for X forwarding

--
Suvayu

Open source is the future. It sets us free.


Tim X

unread,
Jun 24, 2009, 3:49:01 AM6/24/09
to
Harry Putnam <rea...@newsguy.com> writes:


You didn't specify what version of emacs. The emacsclient has changed in
version 23 and I *think* some of those changes were backported to emacs
22.

At any rate, running emacs 23, I can ssh to my remote system and run
emacsclient so that it pops up a new emacs X frame, so essentially, I
get what you want pretty much out of the box. The only thing I had to
configure was to tell ssh to forward X11 connections to my local host.

I'm not sure if this X frame functionality is available in emacs 22
client. CVS Emacs 23 is very stable - I've been running it now for ages
and have only had a few minor problems that were resolved
quickly. (and I do mean minor and I do mean a few - less than 5

Tim


--
tcross (at) rapttech dot com dot au

Josef G. Bauer

unread,
Jun 24, 2009, 4:32:12 AM6/24/09
to
Hi,

> I want to run emacsclient on localhost but connect to emacs-server
> running running on remotehost.

you might want to try 'gnuclient -h SERVER'. Works very well for
me. It's quite a bit tricky to install (for emacs 22), as far as I
remember.

Greetings

Josef

Richard Riley

unread,
Jun 24, 2009, 6:40:52 AM6/24/09
to
suvayu ali <fatkasuv...@gmail.com> writes:

-X here if not enabled by default on the server.

Anselm Helbig

unread,
Jun 24, 2009, 8:13:35 AM6/24/09
to
Hi!

> At any rate a console emacs arrived at that way is a pain in the but
> to use. Its fine for normal file/directory work... but I want to
> access an emacs/gnus session running on the remote emacs-server. And I
> want the emacsclient to run in X on the localhost.

A console emacs doesn't have to be so bad.

- the "backspace invokes help"-issue goes away after "stty erase '^?'"

- you can get more than 16 colors on the console in xterm or rxvt, see
http://www.emacswiki.org/emacs/XTermColors

- xterm-mouse-mode allows you to use your favourite pointing device

I have to admit that you don't get a tool bar and the menu looks a bit
ugly. But then, who needs these, anyway? 8-)

The primary advantage of using emacs in a remote terminal instead of
forwarded via X is speed - forwarding an X client over a WAN might
feel sluggish.

Maybe you should consider using a local emacs and TRAMP to access
your remote files.

Regards,

Anselm


--
Anselm Helbig
mailto:anselm.helb...@googlemail.com

Harry Putnam

unread,
Jun 25, 2009, 12:47:19 AM6/25/09
to help-gn...@gnu.org
Anselm Helbig <anselm.helb...@googlemail.com> writes:

> Hi!
>
>> At any rate a console emacs arrived at that way is a pain in the but
>> to use. Its fine for normal file/directory work... but I want to
>> access an emacs/gnus session running on the remote emacs-server. And I
>> want the emacsclient to run in X on the localhost.
>
> A console emacs doesn't have to be so bad.

From linux local to linux remote... its not bad. Or over putty.
but when solaris is involved its orders of magnitude worse.

there is much more than the erase issue.

> - the "backspace invokes help"-issue goes away after "stty erase '^?'"

> - you can get more than 16 colors on the console in xterm or rxvt, see
> http://www.emacswiki.org/emacs/XTermColors

The colors would have to be endlessly tweaked to get something close
to what I use in X... I know because I've done it a few times.

> - xterm-mouse-mode allows you to use your favourite pointing device

There is no mouse in console mode on solaris.

> I have to admit that you don't get a tool bar and the menu looks a bit
> ugly. But then, who needs these, anyway? 8-)

I don't use those even in X.

> The primary advantage of using emacs in a remote terminal instead of
> forwarded via X is speed - forwarding an X client over a WAN might
> feel sluggish.

This is strictly a local home lan...hard wired and with gigabit NICS.

> Maybe you should consider using a local emacs and TRAMP to access
> your remote files.

Well, like I mentioned in OP.. I want to be able to tap into a gnus
session running on the remote...You can't do that with tramp, so its
not really an issue of access and editing files... I want to read news
and mail and not have to fight with several things I'm used to having.
M-x work without using Esc. I don't have to hold down the control
key and hit h to backspace to the left.

Various other aggravations too.

Linux to linux in console mode is fine .. I even prefer it for lots of
things. But throw Solaris into the mix... and its just more than I
want to dick around with... and don't really want to fuss with everything
to get it to work like I'm used to.

Solaris developers.. have never put much time into the console
mode... its still like it was in the 80s on linux.

I just want to pull that session across in X and everything is hunky
dorey. No endless fixes involved.

The suggestion about editing sshd_config was all it took. I'd just
forgotten to do that.. and where etc.

When I just want to edit files across a real wan... not read News
across a home lan.. I'm good with vi or vim. (ducks for asbestos undies)

to...@tuxteam.de

unread,
Jun 25, 2009, 3:28:24 AM6/25/09
to Harry Putnam, help-gn...@gnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jun 24, 2009 at 11:47:19PM -0500, Harry Putnam wrote:

[...]

> Well, like I mentioned in OP.. I want to be able to tap into a gnus

> session running on the remote...You can't do that with tramp [...]

> Various other aggravations too.

Have you thought of tunneling the emacs client <--> server connection
through SSH?

Not tried yet, and I'm not sure whether there is'nt any better way --
(gurus invited to chime-in ;-) but that is a rough sketch of how I would
proceed:

(1) Start Emacs server on your server machine, tell it to listen on TCP:
emacs --daemon --eval '(setq server-use-tcp t)'
(of course, typically you wouldn't use --eval in the command line,
but rather put (setq ...) into some suitable startup file)
Now the Emacs daemon is running and accepting connections via tcp.
Maybe you can access it directly from your local network. If
security is enough, you might skip step (3).

(2) Transfer the file ~/.emacs.d/server/server to your client machine.
It contains (among other things) a cookie which the client has to
present to the server to appease the dogs at its entrance.

(3) Among those "other things" there is a server address and port
number. With some shell magic, create a shell command along the
lines of
ssh -Llocalhost:<localport>:localhost:<emacsport> <youruser@yourserver>
where you choose <localport> and extract <emacsport> from the file
in (2) above
Note that this step is only strictly necessary if you don't want
to have your Emacs server listening in your home net (you'll have
to dissuade it from doing so by some other means, though).

(4) Give your client in the client machine the server cookie from (2).
If you have done (3) and if <localport> and <emacsport> differ,
you might have to edit the cookie file:
emacsclient --server-file <the cookie from (2), edited if necessary>

Of course, if you are more fluent in elisp, you might substitute the
shell magic above with sufficient elisp magic. It's just more magic.

(5) Let us know whether that works ;-)

Regards
- -- tomás

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKQycYBcgs9XrR2kYRAiEzAJ0Rk/Vj0hiR15Qw1/dp49YUBFIb+QCffpcc
rbEd283dkeQc2B3rJ0jdfRM=
=Gl3r
-----END PGP SIGNATURE-----


Richard Riley

unread,
Jun 25, 2009, 7:13:11 AM6/25/09
to
to...@tuxteam.de writes:

> -- tomás
>
>

What does all that achieve that is different from connecting using
emacsclient over standard ssh (with known_host/key allowing connection)
and x forwarding?

Harry Putnam

unread,
Jun 25, 2009, 7:38:37 AM6/25/09
to help-gn...@gnu.org
to...@tuxteam.de writes:

Ahhh no... I think I'll pass. A simple edit in /etc/sshd_config was
all I needed.

to...@tuxteam.de

unread,
Jun 25, 2009, 8:20:30 AM6/25/09
to Richard Riley, help-gn...@gnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Jun 25, 2009 at 01:13:11PM +0200, Richard Riley wrote:
> to...@tuxteam.de writes:

[...]

> What does all that achieve that is different from connecting using
> emacsclient over standard ssh (with known_host/key allowing connection)
> and x forwarding?

Following my sketch, you don't forward the X connection, but the emacs
client <--> server connection. With X forwarding, the Emacs client
(resp. the Emacs process) runs on the "server".

What prompted me to sketch this was the OP's requirement to connect to a
running Gnus on the server. There I see the two alternatives mentioned above.

No idea whether this buys you anything. It might be faster over a slow
link.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKQ2uNBcgs9XrR2kYRAvKhAJ9IVFwkN6t5eXsjuI6icqfOMNMCQQCeMrIK
9cbZly1iTHtJXNRRtfLUiMA=
=dZWT
-----END PGP SIGNATURE-----


Richard Riley

unread,
Jun 25, 2009, 8:47:05 AM6/25/09
to
to...@tuxteam.de writes:

> On Thu, Jun 25, 2009 at 01:13:11PM +0200, Richard Riley wrote:
>> to...@tuxteam.de writes:
>
> [...]
>
>> What does all that achieve that is different from connecting using
>> emacsclient over standard ssh (with known_host/key allowing connection)
>> and x forwarding?
>
> Following my sketch, you don't forward the X connection, but the emacs
> client <--> server connection. With X forwarding, the Emacs client
> (resp. the Emacs process) runs on the "server".

Which is what you want. Since x forwarding is optimised for transfer I
would have thought?

>
> What prompted me to sketch this was the OP's requirement to connect to a
> running Gnus on the server. There I see the two alternatives mentioned above.
>
> No idea whether this buys you anything. It might be faster over a slow
> link.
>
> Regards

> -- tomás
>

Richard Riley

unread,
Jun 25, 2009, 8:49:35 AM6/25/09
to
Richard Riley <riley...@gmail.com> writes:

> to...@tuxteam.de writes:
>
>> On Thu, Jun 25, 2009 at 01:13:11PM +0200, Richard Riley wrote:
>>> to...@tuxteam.de writes:
>>
>> [...]
>>
>>> What does all that achieve that is different from connecting using
>>> emacsclient over standard ssh (with known_host/key allowing connection)
>>> and x forwarding?
>>
>> Following my sketch, you don't forward the X connection, but the emacs
>> client <--> server connection. With X forwarding, the Emacs client
>> (resp. the Emacs process) runs on the "server".
>
> Which is what you want. Since x forwarding is optimised for transfer I
> would have thought?

Ignore that. I see what you mean now.

I dont fully understand the differences, but I see where you are going!

>
>>
>> What prompted me to sketch this was the OP's requirement to connect to a
>> running Gnus on the server. There I see the two alternatives mentioned above.
>>
>> No idea whether this buys you anything. It might be faster over a slow
>> link.
>>
>> Regards
>> -- tomás
>>

--

0 new messages