Skip to content

Emacs SSH

When you modify Emacs on your desktop, it is usually faster and visually more appealing to work with rather than remote Emacs. Also, you can frequently update it and modify it as much as you want. But how Emacs can be modified to edit file remotely.

Hopefully, there is a package which is called Tramp. It can be used to remotely connect to a server and edit the files there.

The steps to do so:

  1. OpenSSH should be installed and configured correctly. It usually configured via PowerShell. It is installed by default on Win10. If it has been configured correctly, it can be run from command line. Two important commands which are used by Tramp are ssh and scp. The details of installation can be found via internet. The installation process consists of extracting the OpenSSH to c:\OpenSSH and then some commands in PowerShell.
  2. Install PuTTy and follow other things from this link:

https://www.emacswiki.org/emacs/Tramp_on_Windows

for configuring PuTTy, this link is helpful:

https://devops.ionos.com/tutorials/use-ssh-keys-with-putty-on-windows/

The only command which should be used for ssh connection via Emacs is:

/plinkx:session_name:

Which session_name is the session that has been configured and saved in PuTTY with saved private and public keys.

Sometime on the Linux with newer versions of Tramp, there may be connection error because of fancy output of server log in terminal. In that case we may need disable the fancy terminal with the following command in .bashrc script:

if [[ $TERM == "dumb" ]]; then
    export PS1="$ "
else
    {some fancy commands that prevent Tramp connection}
fi

Published inTools

Be First to Comment

Leave a Reply