agentleFS
Alex72-pyAlex72-py/termux-elite/skills/termux-sshd/SKILL.md

termux-sshd

Skill2 starsChanged 57 days agoMITView on GitHub

Set up, harden, and debug the OpenSSH server on Termux (port 8022, key authentication, connection refused, permission denied, host key warnings). Use when the user wants to log in to the phone from a computer, or an ssh connection to Termux fails. Do NOT use for outbound ssh and git keys (see git-credentials), and never expose the server beyond a trusted network.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Run sh scripts/check-sshd.sh (read-only.

    line 24
  2. Very specific:

    Start with sshd; stop with pkill sshd.

    line 28
  3. Very specific:

    Prefer key authentication: put the client's public key in ~/.ssh/authorized_keys.

    line 29

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Termux SSH Server

Purpose

Give a trusted computer shell access to Termux, or find out why that connection fails, without leaving a weakly protected network service behind.

When to use

  • The user wants to ssh or scp into the phone.
  • Connection refused, Connection timed out, Permission denied, or a host key warning when connecting to Termux.

When NOT to use

  • Outbound ssh from Termux to a server or GitHub: git-credentials.
  • Any request to make the phone reachable from the public internet. Decline port forwarding to the internet; suggest a VPN or tunnel the user controls.

Preconditions

Run sh scripts/check-sshd.sh (read-only; reports file modes and config lines, never key contents). Know the client OS and whether both devices are on the same trusted network.

Decision tree

  1. Needs the openssh package. The server listens on port 8022, not 22, because Android does not let unprivileged apps bind ports below 1024. The login name is the output of whoami.
  2. Start with sshd; stop with pkill sshd. It does not start by itself; for that see termux-services.
  3. Prefer key authentication: put the client's public key in ~/.ssh/authorized_keys. ~/.ssh must be mode 700 and authorized_keys mode 600; home must not be writable by others, or sshd ignores the key.
  4. Set a password only as a fallback (passwd). After a key login works in a second session, set PasswordAuthentication no in $PREFIX/etc/ssh/sshd_config and restart sshd.
  5. Connection refused: sshd is not running, wrong port, or wrong address. Connection timed out: wrong network, or the access point isolates clients. Find the phone's address in Android Wi-Fi details (interface listing commands are restricted on recent Android).
  6. Permission denied (publickey): modes from step 3, wrong user name, wrong key offered (ssh -v), or the key line is split across lines.
  7. REMOTE HOST IDENTIFICATION HAS CHANGED after reinstalling Termux is expected; remove the old entry on the client after confirming the change is yours.
  8. For a server-side view run sshd -D -d -p 8022 in a spare session; stop it with Ctrl-C.
  9. Sessions that drop when the screen turns off are Android suspending Termux: background-processes.

Example

  • Situation: ssh user@phone times out on port 22.
  • Without the skill: Tries to bind sshd to port 22 and enables password login.
  • With the skill: Explains Termux listens on 8022, logs in with the whoami name, installs the public key with modes 700 and 600, and disables password login only after a key login works.

Safety

This opens an inbound network service. Use it only on a trusted network, with key authentication, and stop it when done. Never edit sshd_config without a copy, never enable root-style options or empty passwords, and never print private keys or authorized_keys content beyond key comments the user already shared.

Verification

From the client, ssh -p 8022 <user>@<phone-address> logs in with the key and no password prompt; pgrep sshd shows the daemon on the phone; after hardening, a password attempt is refused.

Rollback

Restore the saved sshd_config copy, pkill sshd, and remove any authorized_keys line added for this session.

Handoffs

  • termux-services to start sshd at boot with supervision.
  • termux-network when the device is unreachable for network reasons.
  • background-processes when sessions drop with the screen off.
  • git-credentials for outbound keys.

Report

Address and port, auth method in effect, what was changed in config (with the backup path), and the client login result.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.