dsh-ssh-hosts: Managing Multiple SSH Servers by Hostname in DSH Sessions

Preface

In DeepSeek Harness (DSH), enabling agents to connect to remote machines typically involves repeating host, user, and jump host information in every conversation, or relying on the local ~/.ssh/config without a stable, enumerable list of hosts on the model side. The client plugin dsh-ssh-hosts by maintainer alfredhuang211 (GitHub: alfredhuang211/dsh-ssh-hosts, current package version 0.5.0, MIT License) consolidates multiple servers into a single host inventory. Agents can reference them by name within sessions to execute commands, read files, write files, edit files, and list directories. Credentials only describe “how to connect” (host, user, identityFile, jump host); passwords and key contents are not included in the inventory. Authentication, known_hosts, and ssh-agent are delegated to the system OpenSSH.

What is this

dsh-ssh-hosts is a client-side plugin in the DSH ecosystem: it manages hosts via a graphical interface or YAML and exposes tools like ssh_hosts, ssh_run, and ssh_read to the agent. It is classified as a client plugin. It can be searched on the SkillHub directory page: https://www.skillhub.cn/plugins/alfredhuang211/dsh-ssh-hosts (Note: The community directory is an independent site and has no official affiliation with DeepSeek / High-Flyer).

Compared to “verbally stating the IP every time,” the name in the inventory serves as the session reference name. Compared to bare SSH scripts, the read/write semantics are consistent with local DSH tools (e.g., read uses line numbers for offset/limit, and edit requires a unique oldString).

Core Features

The following describes capabilities based on the plugin README and package.json declarations.

Agent Tools (7)

Tool Function
ssh_hosts List hosts (tags, descriptions, default directories, auth methods), filterable by tag
ssh_use Read/Set the current session default host
ssh_run Execute commands, return exitCode / stdout / stderr (non-zero exits are treated as normal results)
ssh_read Read text files, support line number ranges
ssh_write Write entire file (remote temp file + rename, preserving original permissions)
ssh_edit Precise string replacement (unique match required by default)
ssh_ls List directory (type, permissions, size, time)

Host resolution order: Explicit host → Session ssh_use → UI default host → config.defaultHost → Error and list available hosts (it will not silently guess a host).

Graphical Interface and Inventory

  • Path: Settings → Plugins → dsh-ssh-hosts, or the settings sidebar “SSH Hosts”.
  • Add/Edit/Delete, test connectivity, set default host; UI writes are synchronized with ssh-hosts.yaml and take effect immediately without restarting the plugin.
  • Click the ”+” to the left of the session input box → select ssh from the command menu to click-select a host and set the current session default host; alternatively, use /ssh <hostname> or /ssh clear.

Login and Security Boundaries

Method Inventory Syntax Description
Key identityFile File must exist with 0600 permissions
Password passwordRef Value stored in DSH credential store, inventory only keeps the reference name
Key first, password fallback Both fields configured Corresponding mode selectable in UI
ssh-agent / Default key Both fields omitted Delegated to OpenSSH

The inventory forbids plaintext password: / passphrase:. A single host can be set to readOnly: true to reject ssh_write / ssh_edit. config.allow / config.deny can apply command regex whitelists/blacklists to ssh_run (deny takes priority).

Installation and Activation

Engine requirements (package.json): Node >=22, DSH >=0.2.0-rc.1 <0.3.0.

Install the plugin directory or the tgz obtained via npm pack into the specified profile:

dsh plugin --profile web add /absolute/path/plugin-dev/ssh-hosts

The desktop version can install the same tgz or directory via Settings → Plugins. The plugin declares dsh.bundle.patch; after installation, it inserts id: ssh-hosts to participate in profile assembly.

After installation, verify with:

dsh web --dump-config | grep -A2 ssh-hosts

Expect to see something similar to:

# == dsh-ssh-hosts
- id: ssh-hosts
  name: dsh-ssh-hosts

Note: dsh plugin --profile desktop ... will be rejected (desktop profile is exclusive to Electron); to install into the Desktop App, use the plugin interface within the App, or follow the App documentation to use a link: dependency and restart to load.

Offline / Internal Network

Releases provides packaged dsh-ssh-hosts-x.y.z.tgz files, which can be used with the aforementioned dsh plugin add pointing to the package.

Manual Patch (Optional)

Add the following to ~/.dsh/profiles/<name>/cordis.patch.yml or ~/.dsh/cordis.patch.yml:

- insert:
  - id: 'ssh-hosts'
    name: 'dsh-ssh-hosts'
    config:
      defaultHost: web-01

The config fields have default values; only write items you need to override.

Configuring Host Inventory

Default data file path: $DSH_HOME/ssh-hosts.yaml (plugin config field hostsFile can change this). Permissions must be 0600, otherwise loading is refused.

To start manually, copy the example and edit it:

cp ssh-hosts.example.yaml ~/.dsh/ssh-hosts.yaml
chmod 600 ~/.dsh/ssh-hosts.yaml
$EDITOR ~/.dsh/ssh-hosts.yaml

Example snippet (name / host are required, unknown fields will cause an error):

version: 1

hosts:
  - name: web-01
    host: 10.0.0.11
    user: deploy
    identityFile: ~/.ssh/id_ed25519
    defaultWorkdir: /srv/app
    description: Production Web (Nginx)
    tags: [prod, web]
    port: 22
    proxyJump: bastion
    readOnly: true

  - name: db-01
    host: 10.0.0.12
    user: root
    passwordRef: DSH_SSH_HOSTS_PASSWORD_DB_01
    tags: [prod, db]

Common plugin config scalars (changes take effect on the next tool call, no restart needed): defaultHost, strictHostKeyChecking (default accept-new), connectTimeoutSec, timeoutMs, maxOutputBytes, maxReadBytes, controlPersistSec, etc. If config.hosts is not empty, hostsFile is ignored and the UI becomes read-only; changing hosts requires a restart.

Typical Usage

Natural Language (In Session)

Run systemctl status nginx on web-01
Check /etc/mysql/my.cnf on db-01
Change PORT=8080 to PORT=9090 in /srv/app/.env on web-01

The agent will first call ssh_hosts(), then invoke the corresponding tools with the host.

Explicit Tool Calls

ssh_hosts()
ssh_use({ host: "web-01" })
ssh_run({ command: "uname -a" })
ssh_run({ host: "db-01", command: "df -h" })
ssh_read({ host: "web-01", path: "/etc/nginx/nginx.conf", offset: 1, limit: 40 })
ssh_write({ host: "web-01", path: "/tmp/hello.txt", content: "hi\n" })
ssh_edit({ host: "web-01", path: "/srv/app/.env", oldString: "PORT=8080", newString: "PORT=9090" })
ssh_ls({ host: "web-01", path: "/srv/app" })

Once ssh_use or a global default host is set, ssh_run etc. can omit the host.

Suitable Scenarios and Notes

Suitable for: Developers who need to stably reference multiple SSH hosts in DSH sessions and let the agent perform operational reads/writes; environments that already have OpenSSH keys or are willing to use the DSH credential store for password references.

Important Notes:

  1. The plugin invokes the system ssh with the privileges of the current dsh process. Please read the source code and the MIT license before installation to ensure it complies with your organization’s policies.
  2. While the inventory can be backed up and shared, it still contains host, user, and jump host structures. Passwords are only stored in the credential store; deleting a host will synchronously remove the corresponding password entry.
  3. Profiles without a credential service cannot use password login for hosts; the interface will explain the reason.
  4. YAML syntax errors, overly permissive permissions, etc., constitute hard failures during loading; they must be corrected before loading.

Conclusion

dsh-ssh-hosts consolidates “multiple SSH servers” into a manageable host inventory and provides the agent with remote command and file operation semantics consistent with local ones. The settings page and ssh-hosts.yaml are synchronized; hosts can be switched quickly in the session using hostnames or the “+ → ssh” command.

  • Directory Page: https://www.skillhub.cn/plugins/alfredhuang211/dsh-ssh-hosts
  • Repository and Docs: https://github.com/alfredhuang211/dsh-ssh-hosts
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye