Subject: bug#78791: 30.1; Tramp reopening file with sudo after disconnect error message

From: Alexis Bakatine <[email-masked]>
Date: Mon, 16 Jun 2025 07:25:52 +0000

> The notion '/ssh:foo@bar|sudo::' is called ad-hoc multi-hop for a reason
> in the Tramp manual. If you open it, you will see a dired buffer like
> "/sudo:root@bar:~/" - note, that the leading "/ssh:foo@bar:" part is not
> contained there. Tramp knows internally, that it should use this first
> hop when accessing "/sudo:root@bar:".
> 
> However, when you call tramp-cleanup-all-connections, this information
> is removed (by intention, in order to cleanup). When you reopen a file,
> "/sudo:root@bar:" cannot be connected again due to the missing first hop
> information.

It all makes sense better in my head now.

> I recommend you to set either tramp-show-ad-hoc-proxies or
> tramp-save-ad-hoc-proxies to t.

tramp-show-ad-hoc-proxies is working perfectly for what I described.

Thank you a lot for the explanation and solution Michael.
Feel free to close the non-bug and I wish you a great day.

Best regards,

Alexis