Give Codex SSH Access To Remote Devices
guide2026-06-0211 min read
Codex can operate remote machines safely and repeatably once your local computer can SSH to them through stable aliases such as ssh macmini and ssh vps.
sshtailscalecodexremote-access
Summary
This guide shows how to let Codex access your remote Mac, VPS, or Linux machine through SSH without sharing passwords in normal use. The final state is simple: from the computer where Codex runs, commands likessh macmini and ssh vps should log in directly, and Codex can then inspect files, run commands, deploy services, or debug logs on those machines.
The clean setup uses three layers: Tailscale for private networking, SSH keys for authentication, and ~/.ssh/config aliases for readable host names. If a proxy app breaks Tailscale routes, add an explicit route for the Tailscale device or configure the proxy to exclude the Tailscale network.
What This Solves
Codex can only SSH to machines that the local computer can already reach. If you want Codex to manage a remote Mac mini, a VPS, or a self-hosted server, first make the local shell able to run commands like this:Who This Is For
This is for someone starting from zero who wants an AI coding agent running on their laptop to access remote devices over SSH. You do not need deep networking knowledge. You do need enough control over each target machine to enable SSH, install Tailscale if needed, and add one SSH public key to the right user’sauthorized_keys file.
Prerequisites
- A local computer where Codex runs, such as a MacBook.
- A remote target, such as a Mac mini, Ubuntu VPS, or other Linux server.
- Tailscale installed and logged in on the local computer and each remote target.
- SSH enabled on each target.
- A local SSH key such as
~/.ssh/id_ed25519. - Admin access on the local computer if you need to fix proxy route conflicts.
The Workflow
Create or confirm a local SSH key
On the local computer where Codex runs, check whether an SSH key already exists:If there is no The private key stays local at
id_ed25519 key, create one:~/.ssh/id_ed25519. The public key is safe to copy:Enable SSH on a remote Mac
On the remote Mac, open:Turn on The username is the macOS login account on the remote Mac, not the name of your laptop.
Remote Login. If macOS asks who may connect, choose the specific local macOS account that Codex should use. For example, if the account is demo, the SSH command will look like this:Enable SSH on a VPS
Most Linux VPS images already run OpenSSH. If not, install and start it from the VPS console:Confirm the intended login user. Common examples are
ubuntu, debian, root, or a custom user such as demo.Connect all devices with Tailscale
Install Tailscale on the local computer and every remote target. Log them into the same tailnet.On a Linux VPS, a typical install is:On macOS, install the Tailscale app, sign in, and copy the target’s Tailscale IPv4 address. Tailscale addresses usually look like:These are private tailnet addresses. They are not normal public internet IPs.
Test raw SSH before creating aliases
From the local computer, test each device directly:If SSH asks whether to trust the host key, type
yes. If it asks for a password, enter the password for that remote user one time.Then verify identity:Install the local public key on the remote target
After one password login works, add the local public key to the remote user. The manual method is:Copy the full output line, then on the remote machine append it to:Or use this one-command pattern from the local machine, replacing the user and IP:After this, a password should no longer be needed.
Create readable SSH aliases
Edit the local SSH config:Add aliases like this:Now the important commands are short and memorable:
Common Failure Modes
Tailscale uses the
100.64.0.0/10 address range. Example tailnet IPs such as 100.80.10.20 and 100.90.20.30 are sample values for teaching. Use the actual Tailscale IPs shown in your Tailscale app or admin console.Final Checklist
- The local computer has an SSH key at
~/.ssh/id_ed25519. - Each remote target has SSH enabled.
- Each remote target is connected to the same Tailscale network.
- The local public key is in the remote user’s
~/.ssh/authorized_keys. -
~/.ssh/confighas aliases such asmacminiandvps. -
ssh -o BatchMode=yes macmini 'whoami; hostname; pwd'works. -
ssh -o BatchMode=yes vps 'whoami; hostname; pwd'works. - If a proxy app is running, Tailscale target IPs still route through the Tailscale interface.
What To Remember
Codex does not need a special remote-access product. It needs the local shell to have reliable SSH access. The durable pattern is:nc or ssh -vvv tells you whether the port is reachable. Permission denied means authentication. Operation timed out means routing, firewall, or service availability. route -n get tells you whether a proxy app has stolen the path away from Tailscale.
Metadata
Quick Reference
Typeguide
Statuspublished
Date2026-06-02
Retrieval Tags
sshtailscalecodexremote-access
Related
SSH key managementTailscale routingRemote Codex workflows