Getting Claude Code to run via SSH
I spent a few hours trying to get the Mac Claude Code desktop app to run Claude Code on my Synology DSM, sharing the results so no one else feels my pain.
Setup: Synology DSM 7.x, SSH enabled, key auth working, ssh user@nas interactive shell fine.
Symptom: Claude Code desktop "SSH connector" fails on first connect with Connection failed: Failed to upload file: No such file. ~/Library/Logs/Claude/ssh.log shows:
[BinaryDeployment] Remote: home=/var/services/homes/<user>, platform=linux-amd64, shell=posix, binVer=missing [BinaryDeployment] Deploying server binary linux-amd64 … [error] Failed to upload file: No such file Root cause: The connector detects shell $HOME as /var/services/homes/<user> (the real path), then SFTP-uploads its server binary to that absolute path. DSM's SFTP server presents a virtual chroot containing only registered shared folders — /var doesn't exist there — so the upload fails. Standard SSH/scp work fine; only SFTP is restricted this way.
Workaround: Make the absolute path SFTP-resolvable by registering a var shared folder and symlinking the rest into place.
SSH in:
ssh -t <user>@<nas> 'sudo mkdir -p /volume1/var/services/homes
&& sudo ln -snf /volume1/homes/<user> /volume1/var/services/homes/<user>'
(Use the real /volume1/homes/<user> target, not /homes/<user> — the symlink is resolved against the real filesystem, not the SFTP virtual view.)
DSM Control Panel → Shared Folder → Create → Name: var, tick "hide from My Network Places" and "hide from users without permissions". When DSM complains "folder already exists," delete /volume1/var (it should only contain the symlink chain we just made), recreate it, and re-run the wizard.
On the permissions page, give your SSH user Read/Write, everyone else No Access.
Re-run the symlink command from step 1 (DSM may have cleared it during share creation).
Verify: sftp <user>@<nas> <<< 'put /etc/hosts /var/services/homes/<user>/.t && rm /var/services/homes/<user>/.t' should succeed.
Hit "Try again" in Claude Code desktop.
Reversibility: delete the var shared folder in DSM and sudo rm -rf /volume1/var.
Long-term ask for Anthropic: the connector should either probe for an SFTP-writable path (e.g., realpath . over SFTP) and use that, or expose a remote-install-path setting in the SSH connection config.