Lugaru's Epsilon
Editor 14.04

Epsilon User's Manual and Reference
   Commands by Topic
      Buffers and Files
         . . .
         File Variables
            Directory-wide File Variables
            Vi/Vim File Variables
         Internet Support
            Secure Shell and SCP Support
            URL Syntax
         Unicode Features
         . . .

Previous   Up    Next
Internet Support  Commands by Topic   URL Syntax

Epsilon User's Manual and Reference > Commands by Topic > Buffers and Files > Internet Support >

Secure Shell and SCP Support

Besides recognizing ftp:// URLs as described in the previous section, Epsilon also recognizes scp:// URLs, which may be used for secure file transfers. With scp support, you can read or write files using an scp:// URL, navigate the remote system's directory tree using dired, mark files for copying between the local and remote systems, use grep or file-query-replace to search and replace on multiple remote files, and use file name completion.

Epsilon also recognizes ssh:// URLs to connect securely to a command shell on a remote computer, providing a secure alternative to the telnet command. Epsilon's ssh command works similarly to the ssh:// URL. Use the syntax username@hostname to connect as a user other than the default one. The ssh-interpret-output variable controls how Epsilon interprets ANSI escape sequences and similar in an ssh buffer.

The scp and ssh features work by running certain external programs which must be installed and working. Epsilon's ssh command depends on an external ssh program, while its scp features run a program named sftp. On macOS these are normally preinstalled. For Linux or FreeBSD, you may need to install the appropriate ssh package for your distribution. For Windows, the Cygwin system contains appropriate clients. Run the Cygwin installer from the Cygwin website and install Cygwin's openssh package from the net section. Also ensure Cygwin's bin directory is on your PATH, and (on Windows 10) that it appears before the Windows system directory (which contains programs of the same name as the Cygwin ones but which don't work well with Epsilon). See below for a step-by-step setup guide. (On Windows, it's also possible to use alternative clients like PuTTY instead of Cygwin programs. See "Windows-specific Configuration" below for more on PuTTY.)

With scp/ssh support, Epsilon doesn't remember your password or passphrase. Unless you've set up the ssh and scp programs so they don't require a password (see below for a step-by-step guide), Epsilon will ask for it each time it must start a new sftp helper program (for instance, when you begin a second file operation before the first has completed). If you prefer to type your secure passphrase once and have multiple connections use it, you can set up an ssh-agent program, along with public key authentication. The agent will remember your credentials and provide them as required to any sftp or ssh instance. You can even set your credentials to expire after a certain period of time if you wish. Refer to the manual page for the ssh-agent program to set this up. Windows users should also see the section below on Windows-specific configuration.

Customization Options for Alternative Clients

If you're not using the usual external ssh and sftp programs, you'll need to set various variables to tell Epsilon how to run your alternative programs.

The variable ssh-template tells Epsilon how to build a command line for invoking the external ssh program when a specific user name appears before the host name. If no user name was specified, it uses ssh-no-user-template. See the descriptions of these variables for their format. Both these variables normally include the %c sequence, which under Windows makes Epsilon run the command named by the ssh-command-windows variable. There are also numerous variables whose names start with sftp- that may be used to configure Epsilon to work with alternatives to the sftp program.

Some very old sftp programs use a different command syntax for listing files; if you have trouble, try setting the scp-client-style variable to 2 to make Epsilon use old-style sftp commands. You may have to modify scp-list-flags too.

Windows-specific Configuration Options

As explained above, using an ssh-agent program along with public key authentication lets you type your secure passphrase once and have multiple connections use it. The agent must provide some settings that are passed on to the sftp or ssh clients it runs via environment variables. For Windows users running Cygwin, one option is to start Cygwin's bash shell, run the command eval `ssh-agent`, run the ssh-add command, and then run Epsilon from that same shell. Or you can use the run-ssh-agent.bat file included in Epsilon's bin subdirectory to run an ssh agent. The comments in that file explain how to run ssh-agent through it, so it creates a load-ssh-agent batch file that loads agent settings into the environment, and how to set Epsilon variables so Epsilon invokes load-ssh-agent when starting ssh or scp sessions.

To make Epsilon work with the Windows ssh client PuTTY instead of the recommended Cygwin clients, use these settings:

 scp-windows-sftp-command  psftp
 ssh-command-windows  plink
 scp-client-style  2

Be sure to install PuTTY's psftp and plink programs along with the base PuTTY installation. With PuTTY, certain features like file name completion won't be available.

Typical Configuration Walkthrough

Here are some typical steps required to get Epsilon running with secure shell and scp support. We'll assume the goal is to connect from a computer named mypc to a computer named otherbox which runs some kind of Unix-derived operating system, and where you log in using the name "myname".

Part 1: Set up the basic connection

  • If mypc runs Windows, run the Cygwin installer from and have it install its ssh package, which includes the ssh and sftp programs. (Note that Windows 10 includes ssh and sftp clients with the same names as the Cygwin clients, but which don't work well with Epsilon. Either ensure the Cygwin clients appear first on your PATH, or modify the variables ssh-command-windows and scp-windows-sftp-command to include the full path to the Cygwin clients.) On non-Windows systems, install ssh if it's not installed already.

  • Set up otherbox to run an ssh server, which may require installing and/or enabling the server. Test that mypc can access otherbox by name (for example, by typing "ping otherbox" at a command prompt).

  • You should now be able to run ssh from a command prompt on mypc to connect to otherbox, supplying your otherbox user name on the command line if it differs from your mypc user name: "ssh myname@otherbox", and typing your password on otherbox. At this point, you can edit over ssh by typing scp://myname@otherbox at a file name prompt in Epsilon (or scp://otherbox if your names match). But you'll need to type your password for each editing session.

Part 2: Set up an automatic connection

  • If your security needs permit, you may want to set up an automatic connection, where anyone signed into your account on mypc would also be able to access otherbox, with no further authorization required. To do this, first run ssh-keygen on mypc to generate a pair of files in your ~/.ssh directory containing a key pair, and enter an empty passphrase. (We'll assume you used the default file name "id_rsa".)

  • On mypc, run "scp ~/.ssh/ otherbox:.ssh/authorized_keys" to permit connections from mypc to otherbox using the key pair you just created. (If you already have an authorized_keys file on otherbox, perhaps because you connect to it over ssh from other systems, add the line from to its end, don't overwrite it.) Test this by running "ssh myname@otherbox"; it should connect without any prompt for a password.

  • You should now be able to edit over ssh by typing scp://myname@otherbox at a file name prompt in Epsilon, and immediately see a file listing.

Optional: If you'd like to use a shorthand name for otherbox, or skip typing "myname@" each time, or if you chose a non-default key pair name when you ran ssh-keygen, you'll need an ssh configuration file. On mypc, edit \cygwin64\home\YourWindowsUserName\.ssh\config (or ~/.ssh/config on non-Windows systems) and add a section like this:

Host oth
Hostname otherbox
User myname
IdentityFile ~/.ssh/mynewkey

This defines "oth" as a short name for "otherbox". (You can skip this and just use a Host line if you don't need a shorter name.) It says your login name on otherbox is "myname", so you don't have to include it when connecting. You can omit this line if your login name is the same on both systems. And it specifies a different private key file name. You can include other ssh configuration options here; for example, macOS users may want to include "UseKeychain yes" to have ssh get passphrases from your keychain.

Per-System Settings

It's possible to set up Epsilon to use one set of variables for one remote system and a different one for others. To enable this, before checking for a variable such as scp-run-helper-template, Epsilon constructs a new variable name by adding the host name of the remote system to its end. For instance, if you try to access, Epsilon first looks for a variable named scp-run-helper-template-www-example-com; if there's a variable by that name, Epsilon uses it instead of the usual one. (Epsilon constructs the variable name from a host name by replacing each non-alphanumeric character with a -.) It does this for each of its scp and ssh variables.

File Prompts in Ssh and Telnet buffers

When you're edting a local file, commands like find-file prompt, by default, with that file's directory name, so you can easily edit another file in that same directory. Begin typing an absolute pathname to another directory, and the old directory name is automatically deleted. In the same way, when you use commands like find-file from an ssh or telnet buffer, Epsilon prompts with a corresponding scp: URL so you can access files on that same system, and in your current directory on that remote system.

This feature requires Epsilon to parse the prompts coming from the remote system, in order to know what directory you're using. Out of the box, it's designed to work with some typical prompts you might get when connecting to a remote Unix-like system. You can configure it, though, on a per-host basis.

Epsilon uses the net-prompt-pattern variable to match a prompt that contains a directory name. The default setting works with a typical Unix shell prompt setting (PS1) like [\u@\h \w]$ or [\u@\h \w] \! $. A prompt-matching pattern should be written so that its first parenthesized grouping matches the part of your prompt containing your current directory on the remote system.

Alternatively, you can change your prompt to include a special sequence of characters at the end containing your current directory, which Epsilon will notice and remove. This is how Epsilon's concurrent process retrieves current directory information on Unix-based systems, and it's more reliable because it avoids shell settings that might abbreviate the full working directory when it's long. Epsilon includes scripts named and epsilon.csh (for Bourne-style and Csh-style shells) to accomplish this, so you could configure your remote system's login script to run them only for remote connections (by checking the TERM environment variable, for example).

If your connection to a Unix-based host sets the TERM variable to something other than "dumb", you may see odd line breaks in echoed text. A command like "stty columns 65000" should prevent that, and again, this can be done conditionally in the remote system's login script.

You can set up a separate net-prompt-pattern variable for each host you use, by defining a variable with a name like net-prompt-pattern-example-com, as explained in the previous section. You can also write a custom per-host EEL function to translate the retrieved directory into a URL, by defining a function with a name like net_prompt_get_dir_helper_example_com(). See the definition of net_prompt_get_dir_helper( ) in epsnet.e.

You can configure various aspects of remote directory retrieval by setting bits in the net-prompt-get-directory variable. Like other net variables, you can create host-specific versions of the variable. Omit the 1 bit in the original net-prompt-get-directory variable to turn off remote directory retrieval for all hosts; omit it in a per-host variable to disable it for just that host.

Using Ancient Hosts

If you must use a very old version of ssh that lacks an sftp program, or connect to a system that doesn't support sftp, or you want to use an ssh replacement that lacks sftp, it's possible to set up Epsilon to run its own helper program on the remote system.

To do this, copy the C language source code file epsilon-xfer-helper.c included in Epsilon's source directory to the remote system, compile it with "make epsilon-xfer-helper" or similar, and install in an accessible location. It may be compiled on most Unix systems, or, for Windows, using the Cygwin environment. Next, check that you can run the helper program remotely, with a command line like

ssh -l username hostname epsilon-xfer-helper

It should print a greeting line and await a command. Type ^C or press <Enter> to make it exit. You may need to edit the Epsilon variable scp-run-helper-template to include the path to the helper program, or if you use a different ssh program. For instance, if you use an ssh client "oldssh" that lacks an sftp program, set it to "oldssh %u@%h /path/to/epsilon-xfer-helper" or similar. (Epsilon uses the above variable when the scp:// url includes a user name, and the scp-run-helper-no-user-template variable when it does not.)

To tell Epsilon to use epsilon-xfer-helper commands, not sftp commands, set the scp-client-style variable to 1. Using the helper program enables a few minor features that the sftp program doesn't currently support, like using ~ to indicate home directories, or copying a remote file to a different location on the remote system (sftp can rename remote files but not copy them).

When you don't use sftp, Epsilon must run a separate program for each file transfer. By default it uses the scp program. The variable scp-read-file-template tells Epsilon how to transfer a file from the remote system to a local file, and scp-write-file-template does the opposite. There are separate versions of these variables for when no user name is included, named scp-read-file-no-user-template and scp-write-file-no-user-template. Change these variables to use a different program for copying files when you don't use sftp.

Standard bindings:

 Ssh mode only: Alt-n  process-next-cmd
 Ssh mode only: Alt-p  process-previous-cmd

Previous   Up    Next
Internet Support  Commands by Topic   URL Syntax

Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.