An AI coding agent running on your server has real power — it can read files, execute commands, and modify code. Deploying one from your phone doesn't add risk if you follow the same security practices you'd use from a laptop. Here's what to get right.
The Threat Model
When you deploy an AI agent, it inherits your SSH user's permissions. The risks are:
- Overprivileged access — the agent can read/write more than it needs to
- API key exposure — keys in environment variables are visible to the agent
- Unreviewed changes — the agent writes code that introduces vulnerabilities
- Session persistence — a tmux session stays active with your permissions
None of these are mobile-specific. They apply whether you're deploying from a phone or a desktop.
SSH Hardening
- Use SSH keys, never passwords — Onepilot stores keys in iOS Keychain (hardware-encrypted)
- Disable password authentication —
PasswordAuthentication noin/etc/ssh/sshd_config - Use non-standard ports — reduce noise from automated scanners
- Enable fail2ban — auto-block IPs after failed attempts
For a full walkthrough, see our SSH from iPhone guide.
Least-Privilege Agent Users
Don't run AI agents as root or your personal admin account. Create a dedicated user:
useradd -m -s /bin/bash ai-agent
Give it access only to the project directory. No sudo. No SSH keys to other servers. If the agent misbehaves, the blast radius is contained.
API Key Management
- Use environment variables — never hardcode API keys in scripts or config files
- Scope keys narrowly — if your LLM provider supports key scoping, limit what each key can do
- Rotate regularly — especially if you share server access with a team
- Use .env files with strict permissions —
chmod 600 .env
Review Before Merge
Never blindly merge AI-generated code. Always:
- Run
git diffto review every change - Run the test suite
- Check for hardcoded secrets or credentials
- Look for common vulnerabilities: SQL injection, XSS, command injection
This takes 5 minutes on your phone. It can save you from a security incident.
iPhone-Specific Security
- Device lock — use Face ID / passcode. Your SSH keys are only as secure as your phone.
- Public WiFi — SSH is encrypted, but use a VPN as an extra layer on untrusted networks.
- Session timeout — don't leave tmux sessions attached indefinitely. Detach when done.
The Bottom Line
Mobile AI agent deployment is as secure as your practices. Use SSH keys, run agents as limited users, review changes before merging, and keep API keys locked down. Onepilot handles the secure connection — you handle the discipline.
Learn the full workflow in our remote AI agent management guide. Or get started with deploying your first agent.