SXAccessSXAccessDocs
Open dashboard

Command line reference

Every sxaccess command and the flags its help shows, grouped the way sxaccess help groups them.

The sxaccess binary is both the command line tool and the agent: the background service that keeps the device connected. Most commands hand their work to the running agent over a local socket, so the agent has to be installed and running; the install script sets up both. The CLI runs on Linux and macOS. On Windows, iOS and Android there is no CLI - those platforms use the app.

sxaccess help sorts the commands into three groups, and the three tables below follow it. sxaccess <command> --help lists the flags of one command.

Getting connected

CommandWhat it does
sxaccess startConnect this device and keep it connected. The first time, it signs the device in. See start below
sxaccess enrollSign this device in without connecting it yet. Takes the same sign-in flags as start and prints Enrolled successfully
sxaccess infoShow whether this device is connected, and to what. See info below

Everyday use

CommandWhat it does
sxaccess stopDisconnect this device and print This device is now disconnected. The device stays enrolled and the agent keeps running. It connects again with sxaccess start, or by itself the next time the agent starts, for example after a reboot, unless --disable-auto-connect is set
sxaccess reach list, add, removeChoose which routed networks this device uses. See reach below
sxaccess ports listShow the port forwarding rules applied to this device: each local port, and the device and port it forwards to
sxaccess shell [user@]hostOpen an SSH session to another device in your network. Run it with sudo. The other device needs its SSH server turned on, and an access rule has to allow TCP 24822 to it - see SSH access. -p, --port picks another port (default 24822)
sxaccess identity list, add, remove, useSwitch between saved sign-ins on this device. See identity below
sxaccess tenant list, current, switchMove this device between the organizations your account belongs to - see Move a device between organizations

Troubleshooting and support

CommandWhat it does
sxaccess diagnose collect, capture, verbosity, keep-mapLogs and archives for support. See diagnose below
sxaccess diagnose trace <in|out> <from> <to>Show how this device's packet filter would handle a test packet arriving (in) or leaving (out); only in is checked against access rules. self as <from> or <to> means this device. -p, --protocol picks tcp (the default), udp or icmp; --sport and --dport set the ports, a random one from 49152 to 65534 when left out; --syn, --ack, --fin, --rst, --psh and --urg set TCP flags. See Trace why a connection is blocked
sxaccess agent install, remove, start, stop, restart, info, reconfigure, serveManage the background agent and its system service. See agent below
sxaccess store list, reset, dropInspect or undo the system changes the agent recorded - see What the agent has stored
sxaccess uninstallmacOS only, run with sudo. Removes the agent, its service, its settings and its logs from this Mac, but keeps the keys that make it the same device: signing in again brings back the device the dashboard already lists. --purge removes those keys too, so signing in again adds a new device - for example to move the Mac to another organization. --keep-data keeps settings and logs as well, as an upgrade would. The two cannot be combined
sxaccess versionPrint the installed version

start - connect

start connects this device and keeps it connected. The first time, it signs the device in - in a browser, or with an enrollment key on a machine without one - and the device appears in the dashboard. After that the agent reconnects by itself, including after a reboot, so this is usually a one-time step. On success it prints This device is now connected.

If the device is already connected, start prints This device is already connected and changes nothing: an enrollment key and any settings you pass are ignored. The exception is naming another identity with --profile, which makes start reconnect with it. To change a setting, disconnect and connect again with the flag: sxaccess stop && sxaccess start --<flag>. --allow-server-ssh needs root, so use the command below for it. Run it as one line: a connection that goes through SXAccess, such as an SSH session to this machine, drops until start has finished. It does not work in a session opened with sxaccess shell: stopping the agent closes that session and ends the command, so use the console or an OpenSSH session.

The agent saves those settings with the identity in use, so they stay in force until you change them again; --block-inbound=false, for example, turns one off. On a machine where identity changes are turned off, the agent saves none of them, and start connects with the settings saved before; see agent below. While an organization you picked with sxaccess tenant switch is active, the agent runs on that organization's own configuration instead, so these settings are saved but not applied: see Move a device between organizations.

If the agent is not installed or not running, start answers cannot reach the SXAccess agent and prints the two commands that fix that. sxaccess agent info tells the two cases apart. If it prints Agent service: Stopped, the service is installed and only needs starting. If it reports the service is not installed, install it, then start it.

shell - sign in through the browser and connect
sxaccess start
shell - no browser here: print the sign-in link instead
sxaccess start --no-browser
shell - unattended, with an enrollment key
sxaccess start --enrollment-key-file /run/secrets/sxaccess-key
shell - change a setting: disconnect first
sudo sh -c 'sxaccess stop && sxaccess start --allow-server-ssh'
shell - the service is stopped: start it
sudo sxaccess agent start
shell - the service is not installed: install it, then start it
sudo sxaccess agent install &&  sudo sxaccess agent start

Flags for start

--no-browser, --profile and --tenant concern the sign-in, and enroll takes them too. The others are settings the agent saves with the identity. Two more flags control quantum resistance, an experimental option that only the CLI agent has; sxaccess start --help lists them, and How traffic is encrypted explains what they do.

FlagDefaultPurpose
--no-browserfalsePrint the sign-in link instead of opening a browser, for a machine you reach over SSH
--profile <identity>last usedThe identity to use, as sxaccess identity list names it
--tenant <organization-id>-The ID of the organization to enrol into, when your account belongs to several. Ignored with an enrollment key, which always enrols into the key's organization - see Move a device between organizations
--allow-server-sshfalseRun this device's built-in SSH server, so other devices can open a session with sxaccess shell. Turning it on needs root. The device also needs SSH Access turned on in the dashboard, and an access rule has to allow TCP 24822 to it
--block-inboundfalseRefuse every inbound connection to this device and to the networks it routes. This overrides the access rules your administrator has set, and turns the SSH server off
--block-lan-accessfalseWhen this device serves as a routing device or an Internet gateway, keep the traffic it routes away from the IPv4 subnets on its own network interfaces, as they are when the device connects. Other subnets behind them, such as the rest of a VPC, and link-local addresses are not covered. Internet gateways shows what to do on a gateway
--disable-auto-connectfalseStay disconnected when the agent starts, for example after a reboot, until someone runs sxaccess start
--disable-client-routesfalseDo not route this device's traffic to the networks published to it
--disable-server-routesfalseDo not let this device route traffic for other devices
--disable-dnsfalseLeave this device's DNS settings untouched
--disable-firewallfalseLeave this device's firewall alone: the agent loads no packet filter, so the port and protocol limits of access rules are not applied here, and --block-lan-access has no effect

info - is this device connected?

This is the command you will run most. Without flags it starts with a headline that sums up the device's links to the management service and to Discovery: Connected, Partly connected (one of the two is down) or Not connected. Discovery is the service through which two devices agree on a path. Below it come this device's name and address, how many devices are connected, the routed networks in use, and the state of the Service, Discovery, the relays and the DNS servers. A device that is not signed in gets a short explanation and the command that fixes it instead.

-d adds the identity in use and whether the tunnel runs in the kernel or in user space. It also adds a block per device with its Path (P2P or Relayed), Candidates, Round trip, Last handshake, Transferred and the networks it Reaches; Troubleshooting the client explains how to read it. -d, --json, --yaml and --ipv4 are mutually exclusive. --ipv4 prints just this device's address, such as 100.72.0.33, and piping --json into jq -c gives one line per device. The four --filter-by-* flags narrow the list of devices by name prefix, address, state or path; any of them turns on the detail view by itself, and they narrow --json and --yaml too.

shell - summary, then every device in detail
sxaccess infosxaccess info -d
shell - machine-readable
sxaccess info --jsonsxaccess info --yamlsxaccess info --ipv4sxaccess info --json | jq -c '.devices.items[] | {dnsName, address, state, path}'
shell - narrow the device list
sxaccess info --filter-by-names device-a,device-bsxaccess info --filter-by-ips 100.72.0.100,100.72.0.200sxaccess info --filter-by-status connectedsxaccess info --filter-by-connection-type Relayed
shell - mask public addresses and outside domains before sharing
sxaccess info -d -A

reach - routed networks

When your administrator publishes networks to this device - the resources of a network, or a route - the device can choose which of them to route to. That matters when a published range overlaps something already on your LAN: you can leave it out on one machine without changing the access rules for everyone. The device has to be connected.

reach list shows each network under its name in the dashboard, a resource's Name or a route's Network Identifier, with state: Selected or Not Selected. reach add takes those names and replaces the current selection with them; with -a it adds them to the selection instead. reach add all selects every published network, including ones published later. reach remove takes names or all.

shell - list the published networks and which are selected
sxaccess reach list
shell - select every published network, including later ones
sxaccess reach add all
shell - select only these two networks
sxaccess reach add office-lan lab-vpc
shell - add one network to the selection
sxaccess reach add -a staging
shell - stop routing to one network
sxaccess reach remove lab-vpc
shell - stop routing to every network
sxaccess reach remove all

identity - more than one sign-in on a machine

An identity is one saved sign-in: its own key, its own settings, its own enrolment. Keep several to move between accounts on the same device without signing in again each time. Every machine has the built-in identity default, which cannot be removed; any other identity belongs to the user who added it. Only one identity is in use at a time.

identity add saves a new, empty identity. identity use switches to another one and disconnects the device if it is connected; sxaccess start then signs in with it the first time and connects. start --profile <identity> does both in one step. You cannot remove the identity in use.

To move between organizations your account belongs to, use the sxaccess tenant commands instead. While an organization picked there is active, its enrolment is the one the agent uses.

shell - add an identity and connect with it
sxaccess identity listsxaccess identity add worksxaccess identity use work && sxaccess start
shell - switch back
sxaccess identity use default && sxaccess start
shell - remove an identity that is not in use
sxaccess identity remove work

diagnose - logs and archives for support

diagnose collect packs the agent's logs, the connection status and system details into one archive and prints Bundle saved to: with its path. diagnose capture <time> is the one to reach for with a fault that comes and goes. It switches the agent to trace logging and reconnects the device, so the capture starts from a fresh connection. It keeps running for the time you give, then builds the archive and puts the log level back. Because it reconnects, sessions running over SXAccess drop; a device that was disconnected is connected for the capture and disconnected again afterwards.

Both take -C, --log-file-count (how many rotated log files to include, default 1) and -S, --system-info (include system details, on by default). Add -A before you send an archive anywhere; What is in a bundle lists what it holds.

diagnose verbosity <level> changes how much the agent logs until it restarts: panic, fatal, error, warn, info, debug, trace. info is the default, so sxaccess diagnose verbosity info puts it back. diagnose keep-map on keeps the last network map the device received in memory, so the next archive includes it; capture turns it on by itself. diagnose trace has a page of its own: Trace why a connection is blocked.

shell - a bundle right now
sxaccess diagnose collect
shell - trace logging for five minutes, then the archive
sxaccess diagnose capture 5m
shell - more detail in the log until the agent restarts
sxaccess diagnose verbosity debug
shell - keep the last network map for the next archive
sxaccess diagnose keep-map on
shell - mask public addresses and outside domains first
sxaccess diagnose collect -A

agent - the background service

The agent is the background process that keeps the device connected. It runs as a system service, and the install script registers and starts it, so you rarely need these commands. install, remove, start, stop, restart and reconfigure change the system service and need root; agent info only reports whether it is running (Agent service: Running). serve runs the agent in the foreground: it is what the system service and the Docker container run, not something you start by hand.

reconfigure registers the service again with the flags you give it. A running agent is stopped and started again, so there is nothing else to restart. --service-env gives the agent environment variables, and each run replaces the whole set: a second run does not add to the first, it takes its place. So list every variable the agent should have in one run, separated by commas, as in --service-env SX_RELAY_ONLY=true,SX_DISABLE_PROFILES=true; see Environment variables. -l sets the level the agent logs at, info unless you give it.

To turn identity changes off on a machine, give the service SX_DISABLE_PROFILES=true, as below. The agent then refuses to add, remove or switch identities. It also stops saving the settings that start passes, so start connects with the settings saved before. The --disable-profiles flag that sxaccess agent --help lists does not do this, because install and reconfigure do not pass it on to the service.

shell - is the agent running?
sxaccess agent info
shell - restart the agent
sudo sxaccess agent restart
shell - turn identity changes off on this machine
sudo sxaccess agent reconfigure --service-env SX_DISABLE_PROFILES=true

Global flags

Every command accepts these, though only some use them. A matching SX_ environment variable overrides each of them - see Environment variables.

FlagDefaultPurpose
-k, --enrollment-key-Enrollment key for unattended enrolment, created under Access → Enrollment keys. For servers and CI machines with no browser. Used by start and enroll
--enrollment-key-file-Read the key from a file instead. Cannot be combined with -k
-n, --hostnamesystem hostnameThe name this device appears under in your network
-l, --log-levelinfotrace, debug, info, warn, error. On agent install and agent reconfigure it sets the level the agent logs at
-A, --anonymizefalseReplace public IP addresses and domains outside SXAccess in the output of info and in archives, so they are safe to share. Private ranges and the addresses of your SXAccess network stay as they are

Support-level options

start also takes options that its help does not show. Use one when support, or another page of these docs, asks for it. Like the settings in Flags for start, they are saved with the identity, and a connected device ignores them, so disconnect and connect again in one line, as start shows.

FlagPurpose
--external-ip-mapPublic addresses to offer other devices as connection candidates, for a machine whose public address is mapped 1:1 to a private one - see NAT and connectivity. Entries are public-ip, public-ip/local-ip or public-ip/interface, comma separated, for example 203.0.113.10/eth0; "" clears them
--dns-resolver-addressA fixed IP:port for the agent's local DNS resolver, for example 127.0.0.1:5053; "" lets the agent choose. See DNS
--preshared-keyAn extra shared secret for the tunnel. Devices only talk to each other when they hold the same one