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
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- background-processesSkill
- git-credentialsSkill
- github-actionsSkill
- node-native-buildSkill
- package-troubleshootingSkill
- proot-boundariesSkill
- python-native-buildSkill
- storage-permissionsSkill
- termux-adbSkill
- termux-apiSkill
- termux-backupSkill
- termux-environmentSkill
- termux-networkSkill
- termux-servicesSkill
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
- Very specific: line 24
Run sh scripts/check-sshd.sh (read-only.
- Very specific: line 28
Start with sshd; stop with pkill sshd.
- Very specific: line 29
Prefer key authentication: put the client's public key in ~/.ssh/authorized_keys.
≈ “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.
Files
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
- Needs the
opensshpackage. 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 ofwhoami. - Start with
sshd; stop withpkill sshd. It does not start by itself; for that seetermux-services. - Prefer key authentication: put the client's public key in
~/.ssh/authorized_keys.~/.sshmust be mode 700 andauthorized_keysmode 600; home must not be writable by others, or sshd ignores the key. - Set a password only as a fallback (
passwd). After a key login works in a second session, setPasswordAuthentication noin$PREFIX/etc/ssh/sshd_configand restart sshd. 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).Permission denied (publickey): modes from step 3, wrong user name, wrong key offered (ssh -v), or the key line is split across lines.REMOTE HOST IDENTIFICATION HAS CHANGEDafter reinstalling Termux is expected; remove the old entry on the client after confirming the change is yours.- For a server-side view run
sshd -D -d -p 8022in a spare session; stop it with Ctrl-C. - 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
whoaminame, 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-servicesto start sshd at boot with supervision.termux-networkwhen the device is unreachable for network reasons.background-processeswhen sessions drop with the screen off.git-credentialsfor outbound keys.
Report
Address and port, auth method in effect, what was changed in config (with the backup path), and the client login result.
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
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.

