npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-linux-ssh

v1.0.2

Published

Koishi插件,通过SSH连接Linux服务器并执行命令

Readme

koishi-plugin-linux-ssh

一个 Koishi 插件,通过 SSH 连接到 Linux 服务器并执行命令。

安装

npm install koishi-plugin-linux-ssh

配置

在 Koishi 配置文件中添加插件配置:

plugins:
  linux-ssh:
    servers:
      - name: "myserver"
        host: "192.168.1.100"
        port: 22
        username: "root"
        password: "your_password"
    defaultServer: "myserver"  # 可选:配置默认服务器
    commandPrefix: "/ssh"
    cooldown: 5000

配置项说明

  • servers: 服务器配置列表
    • name: 服务器名称(用于标识服务器)
    • host: 服务器 IP 地址
    • port: SSH 端口号(默认 22)
    • username: 登录用户名
    • password: 登录密码
  • defaultServer: 默认服务器名称(可选)
  • commandPrefix: 命令前缀(默认 /ssh
  • cooldown: 回复冷却时间,单位毫秒(默认 5000)

使用方法

基本命令

配置了默认服务器后:

  • <前缀> <命令> - 在默认服务器执行命令(简化语法)

任何时候都可以使用:

  • <前缀> <服务器名> <命令> - 在指定服务器执行命令
  • <前缀>.list - 列出所有可用服务器
  • <前缀>.help - 显示帮助信息

示例

配置了默认服务器后(简化命令):

# 执行 ls 命令
/ssh ls -la

# 查看当前目录
/ssh pwd

# 查看磁盘使用情况
/ssh df -h

# 查看系统信息
/ssh uname -a

# 查看进程列表
/ssh ps aux

指定服务器执行:

# 在特定服务器执行命令
/ssh myserver ls -la
/ssh backupserver uptime
/ssh testserver df -h

使用建议

默认服务器配置

如果你主要使用某一台服务器,建议配置 defaultServer,这样可以大大简化命令:

defaultServer: "main-server"

配置后,就可以直接使用 /ssh ls -la 而不需要每次都指定服务器名。

多服务器管理

当需要管理多台服务器时:

  • 使用有意义的名称(如 main-server, backup-server, test-server
  • 设置不同的权限级别
  • 使用 .list 命令快速查看所有可用服务器

安全注意事项

  1. 请确保使用的服务器账户权限最小化
  2. 避免在生产环境中使用 root 账户
  3. 建议为插件创建专门的受限用户
  4. 定期更换服务器密码
  5. 可以考虑使用 SSH 密钥认证代替密码认证
  6. 为插件配置适当的权限等级,限制使用范围

权限管理

建议在 Koishi 中为该插件设置权限,只允许特定用户或群组使用:

plugins:
  linux-ssh:
    # ... 其他配置
    authority: 3  # 设置权限等级

常见问题

Q: 连接超时怎么办?

A: 检查服务器 IP、端口、防火墙设置,以及网络连接是否正常。

Q: 命令执行失败?

A: 确保用户有执行该命令的权限,检查命令语法是否正确。

Q: 中文显示乱码?

A: 确保服务器端设置了正确的字符编码(如 UTF-8)。

许可证

ISC