unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Peter Oliver <p.d.oliver@mavit.org.uk>
Cc: 66667@debbugs.gnu.org, Peter Oliver <git@mavit.org.uk>
Subject: bug#66667: [PATCH] Socket forwarding in emacsclient --tramp-prefix example
Date: Sun, 22 Oct 2023 04:05:57 +0300	[thread overview]
Message-ID: <27539.506233164$1697936816@news.gmane.org> (raw)
In-Reply-To: <20231021150127.66683-1-git@mavit.org.uk> (Peter Oliver's message of "Sat, 21 Oct 2023 16:01:27 +0100")

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

> Previously, the emacsclient --tramp-prefix documentation suggested
> using it in conjunction with a forwarded TCP port.  However, OpenSSH
> has supported forwarding sockets since version 6.7 (released 2014), so
> let’s suggest that instead.  Sockets require less manual configuration
> than ports, are less likely to clash, and are more secure, so will be
> a better choice for the majority of people looking to set up this
> facility for the first time.
>
> * doc/emacs/misc.texi (emacsclient Options): Suggest forwarding sockets.
> ---
>  doc/emacs/misc.texi | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
> index a05b7f6c6ea..93771832ff5 100644
> --- a/doc/emacs/misc.texi
> +++ b/doc/emacs/misc.texi
> @@ -2158,8 +2158,9 @@ emacsclient Options
>  Set the prefix to add to filenames for Emacs to locate files on remote
>  machines (@pxref{Remote Files}) using TRAMP (@pxref{Top, The Tramp
>  Manual,, tramp, The Tramp Manual}).  This is mostly useful in
> -combination with using the Emacs server over TCP (@pxref{TCP Emacs
> -server}).  By ssh-forwarding the listening port and making the
> +combination with using the Emacs server from a remote host.  By
> +ssh-forwarding the listening socket, or ssh-forwarding the listening
> +port @pxref{TCP Emacs server} and making the
>  @var{server-file} available on a remote machine, programs on the
>  remote machine can use @command{emacsclient} as the value for the
>  @env{EDITOR} and similar environment variables, but instead of talking
> @@ -2171,16 +2172,13 @@ emacsclient Options
>  effect as using the @samp{-T} option.  If both are specified, the
>  command-line option takes precedence.
>  
> -For example, assume two hosts, @samp{local} and @samp{remote}, and
> -that the local Emacs listens on tcp port 12345.  Assume further that
> -@file{/home} is on a shared file system, so that the server file
> -@file{~/.emacs.d/server/server} is readable on both hosts.
> +For example, assume two hosts, @samp{local} and @samp{remote}.
>  
>  @example
> -local$ ssh -R12345:localhost:12345 remote
> -remote$ export EDITOR="emacsclient \
> -        --server-file=server \
> -        --tramp=/ssh:remote:"
> +local$ ssh -R "/tmp/emacs-%r.socket":"$@{XDG_RUNTIME_DIR:-$@{TMPDIR:-/tmp@}/emacs%i@}$@{XDG_RUNTIME_DIR:+/emacs@}/server" remote
> +remote$ export EMACS_SOCKET_NAME=/tmp/emacs-$USER.socket
If the host has run /run/user it would make sense to setup the Emacs
socket inside this directory.
If the socket fie is in /tmp every other user can read it, using /run/user is
more secure.
On older systems this might be /var/run/user I think.

> +remote$ export EMACSCLIENT_TRAMP=/ssh:remote:
> +remote$ export EDITOR=emacsclient
>  remote$ $EDITOR /tmp/foo.txt #Should open in local emacs.
>  @end example





  parent reply	other threads:[~2023-10-22  1:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-21 15:01 bug#66667: [PATCH] Socket forwarding in emacsclient --tramp-prefix example Peter Oliver
2023-10-21 16:57 ` Michael Albinus
2023-10-21 19:28   ` Peter Oliver
2023-10-22  7:43     ` Michael Albinus
2023-10-22  9:26       ` Eli Zaretskii
2023-10-22 16:53         ` Peter Oliver
2024-01-10 10:14           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-22  1:05 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
     [not found] ` <65347577.5d0a0220.ab2d6.0249SMTPIN_ADDED_BROKEN@mx.google.com>
2023-10-22 17:09   ` Peter Oliver
2024-04-08 11:26     ` Peter Oliver
2024-04-10  8:48       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='27539.506233164$1697936816@news.gmane.org' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66667@debbugs.gnu.org \
    --cc=bjorn.bidar@thaodan.de \
    --cc=git@mavit.org.uk \
    --cc=p.d.oliver@mavit.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).