Hacker News new | ask | show | jobs
by Zambyte 1020 days ago
I mainly use GNU, but sometimes I develop with a VM running Windows. I mainly live inside Emacs. A nice way to access my Windows system is through TRAMP, which (T)ransparently extends the filesystem at an application level over various protocols. I have found that using Emacs as a Samba client to access Windows works quite well for me.

Unfortunately recent versions of Samba makes it hard (impossible?) to spawn remote processes; else I would be able to use eshell inside Emacs, which is pretty awesome over SSH.

3 comments

I doubt the latest assertion, the impacket tooling is well known for executing code over various interfaces. I have no idea how it works, but I imagine it would be difficult to truely prevent exec over smb.

Fwiw though, windows now supports openssh via a powershell command to install (e.g it’s not some third party binary). I’m not sure if it supports sftp, but it may be worth looking into.

I'll have to give execing over smb another look.

I did try using OpenSSH, but there were issues with using Powershell through eshell over TRAMP. It expects a POSIX shell. I also tried using Cygwin to run OpenSSH, but that didn't work well for my needs.

Tramps works well for simple use cases, like quick config edit or view some files etc. For full blown project development, I found numerous issues with tramp. Many plugins that work well with local files might not work well with remote files. This is not a fault of tramp though, just that not every plugin authors have time to support tramp well etc. At the end, I went with mosh + emacs setup which just works once you spend some time to setup[1] your terminal.

1: https://ananthakumaran.in/2021/07/31/emacs-remote.html

Is TRAMP similar to SSHFS?
It’s more like emacs-flavored RPC. You can edit files on remote hosts using TRAMP, and you can transparently execute processes on the remote host. If you’re editing a remote file and invoke, say, a compiler it will transparently run the compiler on the remote host against the remote file.
Similar, yes. It supports many more protocols than SSH though[0]. It also supports multi-hops, even across multiple protocols if it can[1]. So you could say: access a remote server over SSH, and then pivot to a Windows machine behind a firewall using Samba, all by simply specifying a file path to do that.

[0] https://www.gnu.org/software/tramp/tramp-emacs.html#Connecti...

[1] https://www.gnu.org/software/tramp/tramp-emacs.html#Ad_002dh...

TRAMP is general access via ssh, e.g. you can also use it for executing binaries on the remote machine. In the case of remote files it does something like `base64 -D <(ssh remote base64 remote-file) > tempfile` for read and the inverse for write.