ssh-doctor
SSH triage: Remote Login, launchd sshd, pre-auth closes, stale sessions.
Skill by steipete
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/steipete-ssh-doctor
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/ssh-doctor
What's inside
- Skill name
ssh-doctor- Description
- SSH triage: Remote Login, launchd sshd, pre-auth closes, stale sessions.
- License
- MIT
- Instructions
- 143 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# SSH Doctor
Use when SSH connects then closes before auth, Remote Login seems advertised but unusable, or local/remote Mac SSH needs diagnosis.
## Rules
- Do not print secrets, tokens, full env, or broad secret grep output.
- Validate locally first: loopback failure means server-side sshd/launchd/config; loopback success plus remote failure means network/firewall/filter/listen path.
- Report suspicious config lines before changing `/etc/ssh/sshd_config`.
- Prefer non-interactive SSH:
```bash
ssh -o RequestTTY=no -o RemoteCommand=none HOST 'hostname; id -un'
```
## Baseline
```bash
hostname; id -un; sw_vers
ipconfig getifaddr en0
ipconfig getifaddr en1 2>/dev/null || true
ipconfig getifaddr en7 2>/dev/null || true
sudo systemsetup -getremotelogin
sudo systemsetup -setremotelogin on
sudo launchctl print system/com.openssh.sshd 2>&1 | head -80
sudo launchctl kickstart -k system/com.openssh.sshd
sudo lsof -nP -iTCP:22 -sTCP:LISTEN
nc -vz 127.0.0.1 22
ssh -4 -F /dev/null -o RequestTTY=no -o RemoteCommand=none USER@127.0.0.1 'hostname; id -un'
```
Use `BatchMode=yes` only when password fallback would hang or prompt.
## Config
```bash
sudo sshd -T 2>&1 | egrep -i '^(allowusers|denyusers|allowgroups|denygroups|listenaddress|maxstartups|logingracetime|usepam|passwordauthentication|pubkeyauthentication|authenticationmethods)'
sudo egrep -n '^[[:space:]]*(AllowUsers|DenyUsers|AllowGroups|DenyGroups|Match|MaxStartups|LoginGraceTime|ListenAddress|AuthenticationMethods|UsePAM|PasswordAuthentication|PubkeyAuthentication)\b' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* 2>/dev/null || true
```
Suspicious:
- `DenyUsers` matching target user
- restrictive `AllowUsers` / `AllowGroups`
- `Match` block accidentally applying
- tiny `MaxStartups`
- tiny `LoginGraceTime`
- `ListenAddress` missing target interface
## Logs
```bash
sudo log show --last 30m --predicate 'process == "sshd" OR process == "launchd"' --style compact | tail -160
```
Important Mac symptom:
- client: `kex_exchange_identification: Connection closed by remote host`
- server log: `Could not create new instance of inetd service: 67: Too many processes`
- `launchctl print system/com.openssh.sshd`: high `copy count`
- many `sshd-session: USER` processes parented by PID 1
This means launchd accepted TCP but refused to spawn more sshd inetd copies.
## Stale sshd-session Fix
Inspect first:
```bash
sudo launchctl print system/com.openssh.sshd 2>&1 | egrep 'active count|copy count|state =|last exit code|runs ='
ps -axo pid,ppid,uid,user,state,lstart,etime,comm,args | awk '/sshd-session:/ && !/awk/ {print}'
sudo lsof -nP -c sshd-session -iTCP 2>/dev/null | head -120
```
If stale sessions are clearly stranded and blocking new SSH, terminate by selected command-line match:
```bash
ps -axo pid=,args= | awk '/sshd-session: / && !/awk/ {print $1}' | xargs sudo kill -TERM
sleep 2
ps -axo pid=,args= | awk '/sshd-session: / && !/awk/ {print}'
```
If `TERM` leaves blockers, re-check ownership and active shells before using `KILL`.
## Firewall
Only after loopback works but remote fails:
```bash
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --listapps | grep -i ssh -A2 -B2 || true
sudo pfctl -sr 2>/dev/null | head -80
sudo pfctl -si 2>/dev/null | head -80
```
Also check listen address and target interface:
```bash
ifconfig | awk '/^[a-z0-9]+:/{iface=$1; sub(":","",iface)} iface ~ /^en[0-9]+$/ && /inet / {print iface, $2}'
sudo lsof -nP -iTCP:22 -sTCP:LISTEN
```
## OP Profile Block
If asked to ensure `~/.profile` has a Codex-managed `OP_SERVICE_ACCOUNT_TOKEN` copied from another host:
- verify exact variable/markers without printing value
- copy only the matching line/block
- redirect through a `chmod 600` temp file
- never echo the token
Presence check:
```bash
awk 'BEGIN{b=0;e=0;x=0} /BEGIN Codex-managed OP_SERVICE_ACCOUNT_TOKEN/ {b=1} /END Codex-managed OP_SERVICE_ACCOUNT_TOKEN/ {e=1} /^[[:space:]]*(export[[:space:]]+)?OP_SERVICE_ACCOUNT_TOKEN=/ {x=1} END{print "marker_begin", b; print "marker_end", e; print "exact_var", x}' ~/.profile
```
Append from remote host:From steipete/agent-scripts, MIT.
More from steipete/agent-scripts
- 0.843score
codex-first
steipete
Claude Code work routing: delegate hands-on work to Codex under the native-Claude model gate.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.843score
fleet-maintenance
steipete
Mac fleet inventory and upkeep with full/worker profiles: collect installed apps and packages, compare desired versus observed state, audit local-account…
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.840score
project-structure
steipete
Generate a single-file compressed symbol map of a TypeScript or Swift repository — files, exported symbols, typed signatures, plugin boundaries — sized to fit…
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.839score
video-transcript-downloader
steipete
yt-dlp downloads: video, audio, subtitles, transcripts, clips, playlists.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.839score
nano-banana-pro
steipete
Nano Banana/Gemini image gen/edit: text/image input, 512-4K workflows.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.839score
openclaw-relay
steipete
OpenClaw session relay: prompts/posts via local/remote acpx over SSH.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.838score
codex-huge-context
steipete
Codex 1M context: direct OpenAI Responses API inference, safe Astra/Sol/Terra/Luna input headroom, Keychain delivery, and Mac fleet rollout.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.835score
release-mac-app
steipete
macOS app release: Sparkle, notarization, GitHub Release, Homebrew, closeout.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.835score
npm
steipete
npm registry ops: login, whoami, names, publish; 1Password tmux.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.834score
markdown-converter
steipete
Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.829score
remote-mac
steipete
Remote Macs: MacBooks, Mac Studios, hosted claw Macs, Tailscale, SSH, and OpenClaw.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.797score
maintainer-orchestrator
steipete
Coordinate multiple maintainer issues, PRs, or repositories with bounded workers, serialized public actions, and clear owner decisions.
SkillBFreshness: B★ 7.4KClaude Code +9
Signals
- Stars
- 7,401
- Forks
- 646
- Open issues
- 0
- Last commit (this folder)
- May 23, 2026 (5 months ago)
- Last release
- Jul 17, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/steipete/agent-scripts
- Website
- steipete.me
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from steipete
- 0.843score
codex-first
steipete
Claude Code work routing: delegate hands-on work to Codex under the native-Claude model gate.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.843score
fleet-maintenance
steipete
Mac fleet inventory and upkeep with full/worker profiles: collect installed apps and packages, compare desired versus observed state, audit local-account…
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.840score
project-structure
steipete
Generate a single-file compressed symbol map of a TypeScript or Swift repository — files, exported symbols, typed signatures, plugin boundaries — sized to fit…
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.839score
video-transcript-downloader
steipete
yt-dlp downloads: video, audio, subtitles, transcripts, clips, playlists.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.839score
openclaw-relay
steipete
OpenClaw session relay: prompts/posts via local/remote acpx over SSH.
SkillAFreshness: A★ 7.4KClaude Code +9 - 0.839score
nano-banana-pro
steipete
Nano Banana/Gemini image gen/edit: text/image input, 512-4K workflows.
SkillAFreshness: A★ 7.4KClaude Code +9
Cite this page
ssh-doctor skill. Agent Mart. https://agentmart.dev/skills/steipete-ssh-doctor (last updated 2026-10-24)