Connect straight to your server over SSH
Find the server's public address, let the SSH port in, then add the host and trust it on the first connection.
Step by step
Check the server is listening
On the server, confirm the SSH service is running and note its port. It is 22 unless you changed it.
$ sudo ss -ltnp | grep sshdFind the address the phone will dial
A cloud VM shows its public IP or DNS name in the provider's console. At home, use your router's public IP, or a free dynamic-DNS name so the address survives a change.
$ curl -4 https://ifconfig.meLet the port through
Allow the SSH port in the server's firewall. A cloud VM also needs it opened in the provider's firewall rules; a home server needs the router to forward that port to it.
$ sudo ufw allow 22/tcpAdd the host
On the home screen, tap Add host. In the Connection block, put the IP or DNS name in Address, then the username and the port.
Where: Add hostConnectionAddress
Sign in with a key
Generate a key on the phone and append its public key to the server's authorized_keys, exactly as in the first-connection guide, then pick that key under Authentication.
Where: HostAuthentication
Trust the server on the first connection
Tap the host. The app shows the server's fingerprint; compare it with the one printed on the server before you accept.
$ ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pubTurn off password logins
Once the key works, set PasswordAuthentication to no in /etc/ssh/sshd_config and reload the service. Keep one session open while you test, so a typo cannot lock you out.
$ sudo systemctl reload ssh
Let your agent do it
Hand the server side to your coding agent
Run your coding agent (Claude Code, Codex or similar) on the server and paste this. Replace the marked line with the public key you copied from Mochitao: Settings › Hosts › All hosts › Keys, then the key's actions.
You are setting up this machine so I can reach it over SSH from my phone, using the Mochitao app, straight over the internet. Work step by step. Show me every command before you run something that changes the system, and ask when anything is unclear. 1. Detect the operating system. Check whether an OpenSSH server is installed and running and which port it listens on. Install it and enable it at boot if it is missing (Linux: openssh-server, macOS: Remote Login, Windows: the OpenSSH Server feature). 2. Add this public key to authorized_keys for my user, creating ~/.ssh with mode 700 and the file with mode 600 if needed. Do not add it twice: <PASTE THE PUBLIC KEY FROM MOCHITAO HERE> 3. Allow the SSH port in this machine's firewall (ufw, firewalld, nftables or Windows Firewall, whichever is active). Tell me if there is no firewall. 4. Find this machine's public IP address and compare it with its local address to see whether it sits behind a router. Tell me exactly what I still have to do outside this machine: forward the port on the router, or open it in my cloud provider's firewall rules. 5. Print the ed25519 host key fingerprint (ssh-keygen -lf on the host key file) so I can compare it on the first connection. 6. Stop and wait. Only after I tell you key login works from my phone: set PasswordAuthentication no and PermitRootLogin prohibit-password in sshd_config, run sshd -t first, then reload the service. Keep the session I am using open. 7. Finish with a summary: the Address, Port and Username to type into Mochitao, the fingerprint, and anything left for me to do by hand. Never print, read or ask for a private key.
Good to know
- A server open to the internet is tried by bots within minutes. Keys only, no password logins, is the setting that matters; moving off port 22 only quiets the logs.
- Works on mobile data but not on your home Wi-Fi? Many routers cannot loop a request for their own public address back inside. At home, add the server's local address as a second host.
- No public address at all, or a router you cannot change? Use the Tailscale guide instead.
- Very old SSH servers that only offer outdated algorithms are refused on purpose. Updating OpenSSH on the server fixes it.
Something not working? Troubleshooting and contact