Automated summary
Manages SSH sessions non-interactively using the gssh CLI tool, allowing command execution, file transfer, and port forwarding for automated agents.
Strengths
- Fully non-interactive, perfect for agent automation.
- Supports both password and SSH key authentication.
- Robust session management with automatic reconnection and timeouts.
- Built-in sudo support with password, user, and login shell options.
Limitations
- Does not support interactive commands (vim, less, top, etc.).
- Passwords are passed via command line and may be visible in process listings.
- Sudo passwords must not contain single quotes.
When you need to execute commands or transfer files on remote servers scriptically without human interaction.
For tasks requiring an interactive terminal or when command-line password exposure is unacceptable (prefer SSH keys).
Security analysis
CautionThe skill wraps a legitimate SSH management CLI that inherently performs powerful operations (remote exec, file transfer, port forwarding). It uses Bash and accepts credentials on the command line, which poses a risk if misused, but the skill itself does not contain destructive or exfiltrating instructions. It warns about password exposure. The risk is moderate due to the tool's capabilities.
- •Usage of Bash for remote command execution and network operations (SSH, SFTP, port forwarding).
- •Passwords passed via command-line arguments, visible in process lists (ps aux).
- •Tool supports executing arbitrary commands on remote hosts, including sudo with password.
Examples
Connect to server 192.168.1.100 as user 'admin' with password 'secret123' and run 'ls -la /opt'.SSH to 10.0.0.5 using key ~/.ssh/id_rsa, upload local file 'config.yaml' to remote path '/etc/app/config.yaml'.Create a local port forward from localhost:8080 to remote:80 on server example.com with user 'dev' and password 'pass'.name: use-gssh description: "Manage SSH sessions with gssh CLI for agents" allowed-tools: Read, Write, Glob, Grep, Bash version: 1.0.0
设计原则:完全非交互、纯脚本化。所有密码和参数通过命令行传递,不支持交互式操作。
安装
npm install -g @zzzwy/gssh
# 更新
gssh update
启动
# 放后台启动
gssh-daemon &
# 推荐使用pm2 管理
pm2 start gssh-daemon --name gssh
连接认证
# 使用密码
gssh connect -u user -h host -p port -P "password"
# SSH 密钥
gssh connect -u user -h host -i ~/.ssh/id_ed25519
核心命令
| 命令 | 说明 |
| --------------- | ---------------- |
| connect | 建立 SSH 连接 |
| exec | 执行命令 |
| scp / sync | 文件传输与同步 |
| sftp | SFTP 操作 |
| forward | 端口转发 |
| forwards | 列出所有端口转发 |
| forward-close | 关闭端口转发 |
| list | 列出 session |
| use | 切换默认 session |
执行命令
# 普通命令
gssh exec "ls -la"
# 指定 session
gssh exec -s <session_id> "pwd"
# 带超时命令(秒)
gssh exec -t 10 "ls -la"
# 后台运行(推荐格式)
gssh exec "nohup python3 app.py > /dev/null 2>&1 &"
# sudo 命令
gssh exec --sudo --sudo-password "your-password" "sudo systemctl restart nginx"
# sudo 以其他用户运行
gssh exec --sudo --sudo-password "your-password" --sudo-user "www-data" "whoami"
# sudo login shell
gssh exec --sudo --sudo-password "your-password" --sudo-login "whoami"
文件传输
# 上传本地文件/文件夹 -> 远程
gssh scp -put local.txt /remote/path/
gssh sync -put local_dir /remote/path/
# 下载远程文件/文件夹 -> 本地
gssh scp -get /remote/file.txt ./
gssh sync -get /remote/dir ./
# SFTP 目录操作
gssh sftp -c ls -p /home/user
gssh sftp -c mkdir -p /home/user/newdir
gssh sftp -c rm -p /home/user/file.txt
端口转发
# 本地转发: localhost:8080 -> remote:80
gssh forward -l 8080 -r 80
# 远程转发: remote:9000 -> localhost:3000
gssh forward -R -l 9000 -r 3000
# 列出所有端口转发
gssh forwards
# 关闭端口转发
gssh forward-close <forward_id>
Session 管理
gssh list # 列出所有 session
gssh use <session-id> # 切换默认 session
gssh disconnect # 断开
gssh reconnect -s <id> # 重连
选项汇总
| 选项 | 说明 |
| ----------------- | ---------------------- |
| -s | session ID |
| -u | 用户名 |
| -h | 主机地址 |
| -p | 端口(默认 22) |
| -P | SSH 密码 |
| -i | SSH 密钥 |
| -l | 本地端口 |
| -r | 远程端口 |
| -R | 远程端口转发 |
| -put/-get | 上传/下载 |
| -t | 超时(秒) |
| --sudo | 启用 sudo 模式 |
| --sudo-password | sudo 密码 |
| --sudo-user | 以指定用户运行 sudo |
| --sudo-login | sudo login shell(-i) |
限制与注意事项
sudo 限制
- 密码不能包含单引号:
--sudo-password中包含单引号会破坏 shell 语法 - 交互式命令不支持:
sudo vim、sudo less、sudo -i(无密码)等需要 TTY 的命令不支持 - sudo 缓存:sudo 有默认 15 分钟的密码缓存,相同 session 内后续 sudo 命令无需重复输入密码
exec 命令限制
- 不支持交互式命令:vim、less、top、nano 等需要终端的交互式程序无法使用
- 密码暴露:密码通过命令行传递,在
ps aux等命令中可能可见,请确保系统安全 - 管道命令需加引号:含
|、&&、||、>、<、换行等特殊字符的命令需整体加引号
可靠性说明
- 超时机制:
-t超时触发后,远端进程会被 SIGKILL 终止,当前连接立即可用于下一条命令,不需要重启 daemon - 自动重连:连接断开后每 5 秒自动检测并重连,死连接(含网络分区场景)5 秒内可感知
- 大命令支持:exec 命令长度无 4096 字节限制,传输文件路径、长脚本均可正常工作
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/gssh-ssh-session-manager-mrwaka8h' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gssh-ssh-session-manager-mrwaka8h/download' --output '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md.part' && mv '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md.part' '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Write, Glob, Grep, Bash
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md' && test -s '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/use-gssh' && cp -R '.skill-downloads/gssh-ssh-session-manager-mrwaka8h' '.claude/skills/use-gssh'Cursor
test -f '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md' && test -s '.skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/use-gssh' && cp -R '.skill-downloads/gssh-ssh-session-manager-mrwaka8h' '.cursor/skills/use-gssh'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/gssh-ssh-session-manager-mrwaka8h'openskills read 'gssh-ssh-session-manager-mrwaka8h'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/gssh-ssh-session-manager-mrwaka8h/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.