Step 5: Set up the agent
In this step, you'll set up the zrok agent—the recommended approach for always-on shares that need to survive terminal sessions and system restarts.
Why use the agent?
The foreground zrok2 share command in Step 4 stops the moment you close the terminal. The zrok agent runs in the
background, manages all your shares and accesses as a single persistent process, and provides a web UI. When the agent
is running, zrok2 share and zrok2 access commands delegate to it automatically. For a full explanation, see
zrok agent overview.
Try the agent in the foreground
The foreground share from step 4 won't carry over to the agent—it started as its own process and the agent begins fresh. You can leave it running or cancel it; either way, you'll create shares through the agent separately.
To try the agent before installing it as a service:
-
Start the agent:
zrok2 agent start -
In another terminal, open the agent console:
zrok2 agent consoleThis opens the agent UI in your browser. You can create and monitor shares from there, or continue using the CLI.
Install the agent as a background service
For reliable, always-on shares, install the agent as a system service:
- Windows: Set up the Windows agent service
- Linux: Install the Linux agent package
zrok2-agent - Docker: Run the zrok agent in Docker
A native macOS agent package is not yet available. macOS users can run zrok2 agent start in the foreground or use a
third-party process manager.
For more detail on managing shares with the agent, see Manage shares with the agent.