Quick Start
Set up your first VPN connection and run a remote command in 5 minutes.
This guide walks you through setting up Nefia from scratch: generating keys, enrolling a target PC, and running your first remote command.
Step-by-step Setup
Initialize configuration and VPN keys
Run nefia setup --skip-host to create nefia.yaml and generate the operator WireGuard keypair without creating an invite yet:
nefia setup --skip-hostnefia setup is the canonical command and nefia init is an alias. If you prefer to generate the invite during setup, run nefia setup interactively or pass --non-interactive --host-name ... --host-os ....
Log in to your account
Authenticate with your Nefia account:
nefia loginThis opens a browser window for OAuth authentication. Once complete, the CLI stores a refresh token in your system keyring.
Create an invite token
Generate a single-use enrollment token for your target PC:
nefia vpn invite --name my-server --os macos --stunThe --stun flag discovers your public IP automatically via STUN. If you know your public IP, you can use --endpoint your-ip:51820 instead.
Install and enroll the agent on the target PC
Run the one-liner installer with the invite token on the target PC:
curl -fsSL https://www.nefia.ai/install-agent.sh | sh -s -- --token '<INVITE_TOKEN>'This single command will:
- Download and install the
nefia-agentbinary - Validate the HMAC-SHA256 signed token
- Try direct connection to the operator (falls back to cloud relay if needed)
- Perform a WireGuard key exchange
- Establish the VPN tunnel
- Register the SSH host key automatically
- Register as a system service (launchd / systemd)
Verify the connection
Back on the operator PC, check that the VPN tunnel is active:
nefia vpn statusYou should see output like:
VPN Status: active Local Address: 10.99.0.1/24 Listen Port: 51820
Peers: my-server (10.99.0.2) Status: active Endpoint: 203.0.113.10:51820
Run your first remote command
Execute a command on the target PC:
nefia exec --host my-server -- hostnameTry reading a file and listing a directory:
nefia fs read --host my-server --path /etc/hostname
nefia fs list --host my-server --path /var/logTarget all hosts at once:
nefia exec --target all -- uptimeWhat's Next?
Now that you have a working connection, explore these topics:
Complete catalog of Nefia error codes with resolution steps.
Execute commands across multiple hosts with targeting and concurrency control.
Read, write, and sync files across your remote machines.
Learn about NAT traversal, key rotation, and advanced VPN configuration.
Full reference for all Nefia CLI commands and flags.