Agent CLI Reference
The bytehide-agent CLI manages the ByteHide Server Agent. Use it to install, configure, monitor, and uninstall the agent.
Commands
| Command | Description |
|---|---|
bytehide-agent install | Install the agent and configure protection |
bytehide-agent uninstall | Remove the agent completely |
bytehide-agent status | Show current agent status |
bytehide-agent config | View or modify configuration |
bytehide-agent logs | View agent logs |
bytehide-agent --version | Show version |
bytehide-agent --help | Show help |
install
Installs the agent DLLs, sets environment variables, and writes the default configuration.
Bash
bytehide-agent install --token <your-token> [--force]bytehide-agent install --token <your-token> [--force]| Option | Description |
|---|---|
--token, -t | (required) Your ByteHide API token |
--force, -f | Reinstall even if already installed |
What it does
- Extracts agent DLLs to the install directory
- Creates the log directory
- Sets system-wide environment variables (
DOTNET_STARTUP_HOOKS,ASPNETCORE_HOSTINGSTARTUPASSEMBLIES,BYTEHIDE_MONITOR_TOKEN,BYTEHIDE_MONITOR_CONFIG) - Writes
monitor.config.jsonwith default settings
Example
Bash
$ sudo bytehide-agent install --token bh_LYkAhiIrlXQMHALfU8NDILAKx0K9oDcPQ
── Installing ByteHide Server Agent ──
[1/4] Extracting agent files... OK (7 files)
[2/4] Creating directories... OK
[3/4] Configuring environment... OK
[4/4] Writing configuration... OK
✓ ByteHide Server Agent installed successfully!
Install path: /opt/bytehide/agent
Hook DLL: /opt/bytehide/agent/Bytehide.Monitor.ServerAgent.dll
Config: /opt/bytehide/agent/monitor.config.json
Logs: /opt/bytehide/agent/logs
IMPORTANT: Restart any running .NET applications for protection to take effect.$ sudo bytehide-agent install --token bh_LYkAhiIrlXQMHALfU8NDILAKx0K9oDcPQ
── Installing ByteHide Server Agent ──
[1/4] Extracting agent files... OK (7 files)
[2/4] Creating directories... OK
[3/4] Configuring environment... OK
[4/4] Writing configuration... OK
✓ ByteHide Server Agent installed successfully!
Install path: /opt/bytehide/agent
Hook DLL: /opt/bytehide/agent/Bytehide.Monitor.ServerAgent.dll
Config: /opt/bytehide/agent/monitor.config.json
Logs: /opt/bytehide/agent/logs
IMPORTANT: Restart any running .NET applications for protection to take effect.uninstall
Removes the agent completely: deletes DLLs, removes environment variables, and cleans up configuration files.
Bash
bytehide-agent uninstall [--yes]bytehide-agent uninstall [--yes]| Option | Description |
|---|---|
--yes, -y | Skip confirmation prompt |
Example
Bash
$ sudo bytehide-agent uninstall
── Uninstalling ByteHide Server Agent ──
Are you sure you want to uninstall? This will remove all protection. [y/N] y
[1/2] Removing environment variables... OK
[2/2] Removing agent files... OK
✓ ByteHide Server Agent uninstalled.
Running applications will continue to be protected until they are restarted.$ sudo bytehide-agent uninstall
── Uninstalling ByteHide Server Agent ──
Are you sure you want to uninstall? This will remove all protection. [y/N] y
[1/2] Removing environment variables... OK
[2/2] Removing agent files... OK
✓ ByteHide Server Agent uninstalled.
Running applications will continue to be protected until they are restarted.status
Shows the current installation state, environment variables, and protection status.
Bash
bytehide-agent statusbytehide-agent statusExample
Bash
$ bytehide-agent status
── ByteHide Server Agent Status ──
Installed: Yes
Install path: /opt/bytehide/agent
Agent files: 7 DLLs
Environment Variables:
DOTNET_STARTUP_HOOKS = /opt/bytehide/agent/Bytehide.Monitor.ServerAgent.dll
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES = Bytehide.Monitor.ServerAgent
BYTEHIDE_MONITOR_TOKEN = bh_LYk...oDcPQ
Protection: Active — all new .NET processes are protected
Config file: /opt/bytehide/agent/monitor.config.json
Log files: 2 file(s) in /opt/bytehide/agent/logs$ bytehide-agent status
── ByteHide Server Agent Status ──
Installed: Yes
Install path: /opt/bytehide/agent
Agent files: 7 DLLs
Environment Variables:
DOTNET_STARTUP_HOOKS = /opt/bytehide/agent/Bytehide.Monitor.ServerAgent.dll
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES = Bytehide.Monitor.ServerAgent
BYTEHIDE_MONITOR_TOKEN = bh_LYk...oDcPQ
Protection: Active — all new .NET processes are protected
Config file: /opt/bytehide/agent/monitor.config.json
Log files: 2 file(s) in /opt/bytehide/agent/logsStatus Indicators
| Status | Meaning |
|---|---|
| Active | Agent is installed and environment variables are configured correctly |
| Inactive | Agent files exist but environment variables are missing or incorrect |
| Disabled | Agent is installed but BYTEHIDE_DISABLE=true is set |
| Not installed | No agent files found |
config
View or modify agent configuration.
Show configuration
Bash
bytehide-agent config showbytehide-agent config showDisplays the contents of monitor.config.json:
JSON
{
"token": "bh_LYkAhiIrlXQMHALfU8NDILAKx0K9oDcPQ",
"logging": {
"console": true,
"level": "info",
"file": {
"enabled": true,
"path": "/opt/bytehide/agent/logs/monitor.log",
"maxSizeMB": 50
}
}
}{
"token": "bh_LYkAhiIrlXQMHALfU8NDILAKx0K9oDcPQ",
"logging": {
"console": true,
"level": "info",
"file": {
"enabled": true,
"path": "/opt/bytehide/agent/logs/monitor.log",
"maxSizeMB": 50
}
}
}Set a configuration value
Bash
bytehide-agent config set <key> <value>bytehide-agent config set <key> <value>| Key | Description | Example |
|---|---|---|
token | Update your ByteHide API token | bytehide-agent config set token bh_newtoken |
debug | Enable/disable debug logging | bytehide-agent config set debug true |
disabled | Disable agent without uninstalling | bytehide-agent config set disabled true |
Examples
Change token:
Bash
$ bytehide-agent config set token bh_newtoken123
Token updated. Restart .NET applications for changes to take effect.$ bytehide-agent config set token bh_newtoken123
Token updated. Restart .NET applications for changes to take effect.Enable debug mode:
Bash
$ bytehide-agent config set debug true
Debug mode set to: true$ bytehide-agent config set debug true
Debug mode set to: trueTemporarily disable protection:
Bash
$ bytehide-agent config set disabled true
Agent disabled. New .NET processes will NOT be protected.$ bytehide-agent config set disabled true
Agent disabled. New .NET processes will NOT be protected.Re-enable protection:
Bash
$ bytehide-agent config set disabled false
Agent enabled. New .NET processes will be protected.$ bytehide-agent config set disabled false
Agent enabled. New .NET processes will be protected.logs
View agent logs from protected applications.
Bash
bytehide-agent logs [--follow] [--lines <n>]bytehide-agent logs [--follow] [--lines <n>]| Option | Default | Description |
|---|---|---|
--follow, -f | false | Follow log output in real-time (like tail -f) |
--lines, -n | 50 | Number of lines to show |
Examples
Show last 50 lines:
Bash
bytehide-agent logsbytehide-agent logsShow last 100 lines:
Bash
bytehide-agent logs --lines 100bytehide-agent logs --lines 100Follow logs in real-time:
Bash
bytehide-agent logs --followbytehide-agent logs --followInstall Paths
| Platform | Agent DLLs | CLI Binary |
|---|---|---|
| Linux | /opt/bytehide/agent/ | /usr/local/bin/bytehide-agent |
| macOS | /usr/local/share/bytehide/agent/ | /usr/local/bin/bytehide-agent |
| Windows | C:\Program Files\ByteHide\Agent\ | C:\Program Files\ByteHide\CLI\bytehide-agent.exe |
Environment Variables
These are the environment variables managed by the agent:
| Variable | Description |
|---|---|
DOTNET_STARTUP_HOOKS | Path to the startup hook DLL. Set by install, removed by uninstall. |
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES | Assembly name for ASP.NET Core hosting startup. |
BYTEHIDE_MONITOR_TOKEN | Your ByteHide API token. Changed via config set token. |
BYTEHIDE_MONITOR_CONFIG | Path to monitor.config.json. |
BYTEHIDE_DISABLE | Set to true to disable protection. Changed via config set disabled. |
BYTEHIDE_DEBUG | Set to true for verbose debug output. Changed via config set debug. |
Common Workflows
Update token on a running server
Bash
bytehide-agent config set token bh_newtoken
# Then restart your apps
sudo systemctl restart myappbytehide-agent config set token bh_newtoken
# Then restart your apps
sudo systemctl restart myappTemporarily disable protection for debugging
Bash
bytehide-agent config set disabled true
# Restart your app without protection
sudo systemctl restart myapp
# Re-enable when done
bytehide-agent config set disabled false
sudo systemctl restart myappbytehide-agent config set disabled true
# Restart your app without protection
sudo systemctl restart myapp
# Re-enable when done
bytehide-agent config set disabled false
sudo systemctl restart myappCheck if agent is working
Bash
# 1. Check install status
bytehide-agent status
# 2. Enable debug mode
bytehide-agent config set debug true
# 3. Restart your app and check logs
sudo systemctl restart myapp
bytehide-agent logs --follow
# 4. Look for: [ByteHide Server Agent] Initialized (PID: xxxxx)# 1. Check install status
bytehide-agent status
# 2. Enable debug mode
bytehide-agent config set debug true
# 3. Restart your app and check logs
sudo systemctl restart myapp
bytehide-agent logs --follow
# 4. Look for: [ByteHide Server Agent] Initialized (PID: xxxxx)Next Steps
- Server Agent Overview - What is the Server Agent
- JSON Configuration - Customize protection rules
- Troubleshooting - General troubleshooting guide