Client Service Setup#

The client-service command provides a Unix socket interface for attaching and detaching USB devices programmatically. This is useful when you want to integrate USB device attachment/detachment into other applications or services.

Overview#

The client service:

  • Runs as a long-lived process (foreground or systemd service)

  • Listens on a Unix socket for JSON commands

  • Accepts attach and detach requests

  • Returns JSON responses with device information and local device paths

  • Automatically detects the appropriate socket path based on execution context:

    • /run/usb-remote-client/usb-remote-client.sock when running as a systemd service

    • /tmp/usb-remote-client.sock when running in foreground

Running in Foreground#

To run the client service directly in your terminal:

usb-remote client-service

This is useful for testing or development. The service will listen on /tmp/usb-remote-client.sock.

Running as a Systemd Service#

For production use, it’s recommended to run the client service as a systemd service so it starts automatically at boot.

Installation#

Uninstallation#

To uninstall the systemd service:

System-wide service:

sudo -s
uvx usb-remote uninstall-service client
exit

Configuration#

The client service uses the same configuration file format as the regular usb-remote client commands, see Client Configuration File.

IMPORTANT: when running as a systemd service, the configuration file is read from the system-wide location: /etc/usb-remote-client/usb-remote.config