Getting started

Run your first locally approved command from a remote shell.

On this page

Install on both machines #

Install lend on the laptop and the remote host. The installation guide covers Homebrew, release binaries, and source builds. Until the first release is published, build from source:

1go build -buildvcs=false -o bin/lend ./cmd/lend

Put the binary on each machine's PATH. On macOS, build with CGO_ENABLED=1 and the Xcode Command Line Tools installed for native approval and Touch ID. The remote host needs Lend and SSH access. Configure tools such as gh, op, and your existing SSH agent on the laptop.

Write a local policy #

On the laptop, find the executable and key you want to allow:

1command -v gh
2lend keys --socket "$SSH_AUTH_SOCK"

Create policy.json on the laptop. Replace the executable path and fingerprint with the values from those commands:

 1{
 2  "default": "deny",
 3  "require_reason": true,
 4  "commands": [
 5    {
 6      "executable": "/opt/homebrew/bin/gh",
 7      "args_prefix": ["pr", "view"],
 8      "approval": "prompt"
 9    }
10  ],
11  "ssh": {
12    "default": "deny",
13    "keys": [
14      {
15        "fingerprint": "SHA256:REPLACE_WITH_YOUR_KEY_FINGERPRINT",
16        "label": "Remote login",
17        "approval": "prompt",
18        "purposes": ["ssh"]
19      }
20    ]
21  }
22}

Linux often installs gh at /usr/bin/gh. Use the path reported on your laptop. The SSH key rule also permits the initial login through Lend. If the host accepts a different authentication method, configure that in ~/.ssh/config.

This policy permits gh pr view with additional arguments and SSH authentication with one key. Agent management and other commands remain denied. Use "approval": "biometric" on macOS to require biometrics without a password fallback. Approval modes describe the platform requirements.

Download the fuller policy example or profile example for more options.

Check the laptop #

Keep SSH_AUTH_SOCK pointed at your original agent when starting Lend:

1lend doctor --config ./policy.json

Doctor checks the policy, executables, upstream agent, and approval backend. A warning that the local proxy is stopped is expected before opening a session. Resolve any errors before continuing.

Open a session #

From the laptop:

1lend ssh --config ./policy.json -- agent-vm

Replace agent-vm with your SSH host or an alias from ~/.ssh/config. Put options such as the user, port, identity, and jump host in that file. Lend starts a separate local proxy, forwards its socket, and keeps it alive for this SSH connection. Your login may prompt for local key approval.

Request a command #

Inside the remote shell:

1lend doctor --remote
2lend exec --reason "Inspect the pull request before reviewing it" -- \
3  gh pr view 123 --repo example/project

Replace the repository and pull request with ones you can access. Lend checks your laptop's policy and opens the local approval prompt. Review the executable, arguments, reason, and caller context. Approve the request to run gh on the laptop. Its stdout, stderr, and exit code return to the remote process.

Caller context is requester supplied and can be spoofed. It helps you review a request; authorization comes from the local policy and approval.

Watch or stop access #

In another laptop terminal:

1lend status --all --watch
2lend pause --all
3lend resume --all

Closing the SSH session stops its proxy, cancels its pending and running requests, and discards its leases. A paused session refuses new requests until resumed. Activity and history covers individual revocation and persistent logging.

For a coding agent, configure the MCP bridge inside the remote SSH environment. For an existing SSH workflow, use a manually managed proxy.