Skip to content

SSH Remote Integration

The SSH integration enables you to bring your prompts and execute them on a remote server via SSH. In interactive mode, your prompts become available in your remote shell session, executable exactly like on your computer.

Non Interactive Mode

When executing a prompt, you can change the "execution context" to become that of a remote SSH server.

shell
log_analyzer --ssh-dest user@remote_host

This tells remote-capable helpers to execute on the indicated server rather than on your local machine.

For instance if the prompt file of log_analyzer looks like:

handlebars
{{ cat "/var/log/nginx.conf" }}

then executing the prompt with --ssh-dest would fetch and render /var/log/nginx.conf from the specified server. Without --ssh-dest, it would be read locally.

Interactive Mode

Interactive mode allows you to SSH into a server, and execute your enabled prompts on that server directly inside the remote shell, exactly like how you would do on your local machine. Simply prepend promptctl to your usual ssh command while creating the connection:

shell
$ promptctl ssh -p 2222 root@proxmox.lan
# enabled prompts available on server
root@proxmox.lan:~# log_analyzer --help

Under the hood, promptctl just executes your system's SSH binary, thus you may pass all your usual SSH arguments, or define them in ~/.ssh/config as always. This creates a thin, session-bound mapping of remote shell functions to your prompts, and a channel for communicating with your local promptcmd instance.

INFO

In both interactive and non-interactive modes, neither your API keys nor your prompts files are transferred to the remote host. Prompt execution still takes place locally.

Channels

The remote shell communicates with the locally running promptctl for executing prompts via a channel that gets established over the SSH connection. You can choose from several channel types.

TIP

Normally you should not need to change default channel, unless in an unlikely scenario that a target server is not compatible with default one.

ChannelCommunication OverServer Requirements
fifonamed Pipes in a multiplexed SSH connectionAbility to execute mkfifo
ncremote forwarded portTCP forwarding enabled in sshd, nc in path
socatremote forwarded unix socketTCP forwarding enabled in sshd, socat in path
bashtcpremote forwarded portTCP forwarding enabled in sshd, bash

Configuration

In your config you can customize the integration for each server. While establishing the SSH connection, the specified username and server are used in finding the closest matching configuration.

toml
# Global, for all ssh hosts
[[ssh]]
# Display Message of the Day if not disabled by remote user
motd = false
# Communication Channel between remote and local
channel = "fifo"
# Remote shell. Leave default for auto detection.
shell = "auto"

# Define multiple times for different hosts
[[ssh]]
host = "proxmox.lan"
shell = "bash"

# or for a specific user on a host
[[ssh]]
host = "proxmox.lan"
user = "root"
channel = "nc"

See config sample for full reference.

Limitations

The are some limitations that are still currently being worked on:

  • ask helper is not remote compatible, but also breaks the prompt's execution (See #3)
  • SSH Remote execution broken when using a Jump Server (See #2)
  • fifo channel does not work with Jump Server, change to nc or something else (See #4)
  • Terminal multiplexers (tmux/screen) do not work with fish (See #5)