What this doc covers
- Set up Factory’s CLI, Droid, on a Virtual Private Server (VPS) for remote access from anywhere
- Configure SSH authentication with key pairs for secure, passwordless server connections
- Use
droid execfor headless automation tasks and system administration on your server
1. Prerequisites and installation
Before starting, you’ll need:- Factory CLI installed locally - Follow the installation guide
- Factory account - Sign up at factory.ai
- VPS provider account - This tutorial uses Hetzner, but works with any VPS provider (DigitalOcean, Linode, AWS EC2, etc.)
- Basic terminal familiarity - You’ll be running commands in your local terminal and on the server
2. Why use droid on a VPS?
Running AI agents locally limits you to when you’re at your computer. Production debugging, scheduled automation, and mobile access all require a server that’s always available. Without a VPS, you can’t monitor servers from your phone, run headless automation 24/7, or access droid while traveling. By deploying droid on a VPS, you get an always-available AI assistant accessible from any device. Perfect for system administration, production debugging, and building custom automation workflows withdroid exec.
3. Setup and basic usage
Let’s walk through the complete setup process, from creating SSH keys to connecting to your VPS.Step 1: Generate SSH keys with droid
We’ll use droid locally to create an SSH key pair. This is more secure than password authentication and enables seamless connections.~/.ssh/example- Private key (keep this secret, never share)~/.ssh/example.pub- Public key (safe to share, will be added to your VPS)
Step 2: Copy the public key
Step 3: Create your VPS and add the SSH key
In your VPS provider dashboard (Hetzner example):-
Create a new server:
- Choose your server type (e.g., CPX22 - $4.99/month)
- Select a location (e.g., Ashburn, Virginia)
- Keep default options
-
Add your SSH key:
- In the “SSH Keys” section, click “Add SSH Key”
- Paste the public key you copied
- Name it “example” (or any descriptive name)
- Add the key to the server
-
Name and create:
- Optionally name your server (e.g., “example-vps”)
- Click “Create” and wait for the server to spin up
Step 4: Configure SSH for easy access
Once your server is ready, copy its IP address (e.g.,123.45.67.89) and ask droid to configure your SSH settings:
~/.ssh/config file to include something like:
ssh root@123.45.67.89 -i ~/.ssh/example every time, you can simply run ssh example.
Step 5: Connect and install Droid on the VPS
Step 6: Authenticate Droid on the VPS
- It displays a URL and an authentication code
- Copy the code
- Click the URL (or paste it in your browser)
- Paste the code to authenticate
- You’re now logged in and can use droid on your VPS
4. Advanced example: System administration with droid
Now that droid is running on your VPS, let’s use it for practical server administration. This example shows how droid can handle complex setup tasks like configuring a web server.Setting up Nginx with Docker
- Install Docker if not already present
- Create a basic Nginx configuration
- Create an HTML file with “Hello World”
- Set up and run the Docker container
- Configure networking and ports
http://123.45.67.89). You should see “Hello World” displayed.
What makes this powerful: Tasks that normally require multiple commands, configuration files, and troubleshooting are handled by droid with a single natural language instruction. Droid understands best practices and handles edge cases automatically.
5. Droid exec: Headless automation and custom agents
The real power of running droid on a VPS isdroid exec - a headless mode that enables programmatic access for building automation workflows and custom agents.
What is droid exec?
droid exec runs droid commands without an interactive session, making it perfect for:
- Scheduled automation tasks
- Building custom agent frameworks
- Integrating droid into scripts and applications
- Running quick queries from CI/CD pipelines
See the full droid exec docs here.
Basic droid exec usage
Advanced: System exploration
- Search for Nginx configuration files
- Identify the document root
- Locate the HTML/content files being served
- Report back with file paths and relevant configuration
6. Remote access from anywhere
One of the biggest advantages of having droid on a VPS is accessing it from any device, including mobile.Using Termius for mobile SSH access
Termius is a modern SSH client available for:
- macOS, Windows, Linux (desktop)
- iOS and Android (mobile)
- Install Termius on your device
- Add your SSH key:
- In Termius, go to Keychain
- Add a new key
- Import your private key (
~/.ssh/example)
- Add your VPS host:
- Create a new host
- Hostname: Your VPS IP address
- Username:
root(or your configured user) - Key: Select the key you imported
- Connect: Tap the host to connect
Real-world scenarios
- Travel troubleshooting: Server goes down while you’re away? SSH in from your phone and let droid help diagnose and fix the issue
- On-call debugging: Respond to alerts from anywhere with AI-assisted investigation
- Quick queries: Check system status, review logs, or make configuration changes without needing your laptop
Next steps
Now that you have droid running on your VPS:- Explore automation: Start with simple
droid execcommands and build up to custom scripts - Set up monitoring: Use droid to help configure system monitoring and alerting
- Create scheduled tasks: Combine droid exec with cron jobs for recurring automation
- Join the community: Share your use cases and learn from others in the Factory Discord