# How do I let Claude Code work on my server without giving it the password?

Connect Claude Code to your servers through Valakes. It never gets a password or key that Valakes stores, and every host stays closed to it until you open it.

Source: https://valakes.com/guides/let-claude-code-run-commands-without-a-password/

Last updated: 2026-11-29

Claude Code connects to Valakes, and Valakes makes the SSH connection. The agent never gets the passwords or keys you saved in Valakes, and a host stays closed to it until you open it.

Claude Code does not open an SSH connection of its own. It calls ten tools that Valakes serves on your computer, and Valakes opens the session, answers password prompts and holds risky commands for your approval. This guide covers what you decide after the client is connected. The pictures show a test setup with made-up host names. [Letting coding agents work on servers without losing control](https://valakes.com/use-cases/ai-agents-on-servers/) covers the levels and approvals for every agent, not only Claude Code.

## Steps

1. **Connect Claude Code first**

   The setup has its own page: [Connect Claude Code to your SSH servers](https://valakes.com/agents/claude-code/). Follow it to turn on the agent API, add the agent and run the command the wizard shows. Copy that command from the wizard, not from a web page, because it holds your own agent handle.

   The wizard ticks "authenticated over MCP" when Claude Code makes its first call, as in the picture. The wizard knows this only because Valakes saw the call. At this point Claude Code still has no server to work on: if it calls `list_hosts`, it gets the hosts you opened to agents, and you have opened none.

2. **Open one host and keep the level low**

   Every host starts with agent access **Off**, so the host does not exist for the agent. In the host editor, under **Agent access**, choose a level for the one host you want it on. The picture shows the editor with Off selected.

   Read-only runs commands from a short list of read commands. Approve writes runs read commands and asks you about everything else. Full runs commands of Low and Medium risk and asks about High risk. Choosing Approve writes or Full asks for a native confirmation, and a level above Read-only on a production host shows a warning.

   Read-only is not a sandbox, so read the limits below before you point it at a server that matters. An agent can never accept a host key. If the key is not trusted yet, the call fails. Open the host yourself once, compare the fingerprint and trust it, and then the agent can connect.

3. **Bind a saved password to a tool**

   Claude Code never needs the password itself. When a command needs a saved password, it writes the placeholder `{{cred:name}}` and Valakes answers the program's prompt. The agent can list the names of the credentials bound to a host, never their values, and what it reads back has your saved values replaced by `***`.

   A credential works for an agent only if its binding has **Auto-fill** on and its value is at least 6 bytes long. [Run psql on a server without typing the password](https://valakes.com/guides/auto-fill-a-database-password-over-ssh/) shows how to bind one.

   On a production host, a command that uses a credential always waits for your approval, even at the level Full. So does a production credential used on any host.

4. **Approve what it asks**

   A call that the host policy does not allow without asking appears in the approval queue of the Agents panel (`Ctrl+Shift+J`, `Cmd+Shift+J` on macOS). The card shows the exact command, the host, the directory it will run in and the risk Valakes found. The text is Valakes' own record of the command, never text the agent wrote about it.

   **Approve** runs the command once. **Deny** refuses it. **Take over** moves it into your composer so that you run it yourself. The agent never gets the **Run anyway** button of the risk card: a High-risk command is approve or deny. In the picture, claude-code waits to run a command on a staging host with the policy Approve writes. An unanswered request expires after 300 seconds by default.

5. **Pause it or switch it off**

   On the agent's card, **Pause** makes its next call fail with "paused", and **Revoke** ends its access for good. At the bottom of the panel, **Pause all agents** pauses every agent. The **Kill switch** turns the API off, cancels every pending approval and closes the sessions that agents opened. Your own tabs stay.

   To see what an agent did afterwards, read [what an AI agent ran on your servers](https://valakes.com/guides/review-what-an-agent-did/).

## What it does not do

Valakes hides only the values it knows. A password in a `.env` file, or a token that a service prints, is visible to Claude Code if it can read it. Whatever Claude Code reads, including command output, goes to its own model provider under that provider's terms. Valakes cannot control that.

Read-only is a list of read commands, not a sandbox. `cat ~/.ssh/id_ed25519` and `grep -r password /etc` both pass it and hand whatever your SSH account can read to the agent. For real protection, point the host at a server account with no write access that matters, no `sudo` and no keys or secrets in its home folder.

A program that runs as you on this computer can read the token file. Revoke an agent you stop using, and rotate its access if you think the file was exposed. The kill switch does not undo what a command already did: a command started with `nohup` or in `tmux` keeps running on the server after its session closes.

## Documentation and help

[Read the docs: Agents](https://docs.valakes.com/agents/)

[Help centre: The agent cannot connect](https://support.valakes.com/the-agent-cannot-connect/)

## Read next

- [AI agents work under your rules](https://valakes.com/features/ai-agents/): Valakes has a local API that lets an AI agent such as Claude Code or Codex open sessions and run commands on the hosts you allow. The agent never sees a password, and changes wait for your approval.
- [How do I give an AI agent SSH access with the least damage?](https://valakes.com/learn/ai-agents-on-servers/): Give the agent its own account on the server, with no sudo, no password in the prompt and nothing secret in its reach. Let it read first, allow root for one exact command at most, make every change wait for a person, and keep a record of what ran.
- [Can Claude Code SSH into a server?](https://valakes.com/learn/claude-code-ssh/): Yes. Claude Code has a shell, so it can run ssh host 'command' from your machine. It can also run on the server itself, and the desktop app sets that up with its SSH sessions. What the agent can reach, and where your key ends up, depends on the setup you choose.
- [What do I do when Claude Code needs sudo?](https://valakes.com/learn/claude-code-sudo/): Do not paste the password into the chat and do not write NOPASSWD ALL. Run the command with sudo -n so it fails at once, read what the account may run with sudo -l, and give the account a sudoers rule for that one command.
- [How do I let a user run one command with sudo?](https://valakes.com/learn/sudo-for-one-command/): Write a rule that names the command with its full path and exact arguments, put it in its own file under /etc/sudoers.d/, check it with visudo -cf, and install it with mode 440. Do not use wildcards in the arguments, and do not allow editors or any program that can start a shell.

The screenshots show Valakes built from commit 0b8738d, taken on 25 November 2026.
