unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Peter Oliver <p.d.oliver@mavit.org.uk>
To: "Björn Bidar" <bjorn.bidar@thaodan.de>
Cc: 66667@debbugs.gnu.org
Subject: bug#66667: [PATCH] Socket forwarding in emacsclient --tramp-prefix example
Date: Sun, 22 Oct 2023 18:09:05 +0100 (BST)	[thread overview]
Message-ID: <1e698ccf-0f47-5b43-7258-158367d5d92d@mavit.org.uk> (raw)
In-Reply-To: <65347577.5d0a0220.ab2d6.0249SMTPIN_ADDED_BROKEN@mx.google.com>

[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]

On Sun, 22 Oct 2023, Björn Bidar wrote:

>>  @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.
> On older systems this might be /var/run/user I think.

It would, sure, but you can’t in general tell from the local side whether the remote side has /run, nor what your UID is there.  You’d need an extra round trip, for which you need ssh’s ControlPersist option to make performant.  This is too complicated for a simple example.

> If the socket fie is in /tmp every other user can read it, using /run/user is
> more secure.

No, the socket will have permissions 0700, so other users won’t be able to read it.  The risk is that other users will be able to cause a nuisance by creating a file of the same name in its place.  Perhaps it’s better to suggest putting the socket in the user’s home directory (which I originally discounted in case of shared NFS home directories)?

-- 
Peter Oliver

  parent reply	other threads:[~2023-10-22 17:09 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
     [not found] ` <65347577.5d0a0220.ab2d6.0249SMTPIN_ADDED_BROKEN@mx.google.com>
2023-10-22 17:09   ` Peter Oliver [this message]
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=1e698ccf-0f47-5b43-7258-158367d5d92d@mavit.org.uk \
    --to=p.d.oliver@mavit.org.uk \
    --cc=66667@debbugs.gnu.org \
    --cc=bjorn.bidar@thaodan.de \
    /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).