Anysphere ssh client doesn't work with sshpass?

Describe the Bug

I have a working ssh config with proxycommand sshpass (gateway server does not allow ssh key). It works fine within terminal and within VSCode. But it doesn’t work in cursor’s Anysphere ssh client, which still prompts me every time for password.

Steps to Reproduce

My ssh config is like this:
Host [hostname]
HostName [ip_address]
User [user_name]
ProxyCommand sshpass -p [password] ssh [username]@[gateway_ip_address] nc %h %p

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.2.2 (Universal)
VSCode Version: 1.99.3
Commit: faa03b17cce93e8a80b7d62d57f5eda6bb6ab9f0
Date: 2025-07-07T06:07:27.002Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.4.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hi @Peize_Li, could you share the logs from the “Remote - SSH” output window so we can take a closer look?

2025-08-06 15:03:45.350 [info] Resolving ssh remote authority 'g17' (Unparsed 'ssh-remote+7b22686f73744e616d65223a22673137227d') (attempt #1)
2025-08-06 15:03:45.355 [info] SSH askpass server listening on /var/folders/b8/t4lcx7691r9dnst1_ws23bvm0000gn/T/cursor-ssh-PbFyOK/socket.sock
2025-08-06 15:03:45.356 [info] Using configured platform linux for remote host g17
2025-08-06 15:03:45.356 [info] Using askpass script: /Users/lipeize/.cursor/extensions/anysphere.remote-ssh-1.0.23/dist/scripts/launchSSHAskpass.sh with javascript file /Users/lipeize/.cursor/extensions/anysphere.remote-ssh-1.0.23/dist/scripts/sshAskClient.js. Askpass handle: /var/folders/b8/t4lcx7691r9dnst1_ws23bvm0000gn/T/cursor-ssh-PbFyOK/socket.sock
2025-08-06 15:03:45.359 [info] Launching SSH server via shell with command: cat "/var/folders/b8/t4lcx7691r9dnst1_ws23bvm0000gn/T/cursor_remote_install_45835.sh" | ssh -v -T -D 52617 g17 bash --login -c bash
2025-08-06 15:03:45.359 [info] Started installation script. Waiting for it to finish...
2025-08-06 15:03:45.359 [info] Waiting for server to install via process(3586)...
2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: OpenSSH_9.9p1, LibreSSL 3.3.6

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: Reading configuration data /Users/lipeize/.ssh/config
debug1: /Users/lipeize/.ssh/config line 2: Applying options for *
debug1: /Users/lipeize/.ssh/config line 11: Applying options for g17
debug1: Reading configuration data /etc/ssh/ssh_config

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: /etc/ssh/ssh_config line 58: Applying options for *

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Executing proxy command: exec sshpass -p [gateway_password] ssh [gateway_id]@[gateway_ip] nc [server_ip] 22

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: identity file /Users/lipeize/.ssh/id_rsa type -1
debug1: identity file /Users/lipeize/.ssh/id_rsa-cert type -1

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: identity file /Users/lipeize/.ssh/id_ecdsa type -1
debug1: identity file /Users/lipeize/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/lipeize/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/lipeize/.ssh/id_ecdsa_sk-cert type -1

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: identity file /Users/lipeize/.ssh/id_ed25519 type 3

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: identity file /Users/lipeize/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/lipeize/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/lipeize/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/lipeize/.ssh/id_xmss type -1
debug1: identity file /Users/lipeize/.ssh/id_xmss-cert type -1
debug1: identity file /Users/lipeize/.ssh/id_dsa type -1
debug1: identity file /Users/lipeize/.ssh/id_dsa-cert type -1

2025-08-06 15:03:45.365 [info] (ssh_tunnel) stderr: debug1: Local version string SSH-2.0-OpenSSH_9.9

2025-08-06 15:03:45.827 [info] Askpass server received request: POST /
2025-08-06 15:03:45.827 [info] Askpass server received request body: {"request":"([gateway_id]@[gateway_ip]) Password: "}
2025-08-06 15:03:45.827 [info] Received SSH askpass request: ([gateway_id]@[gateway_ip]) Password: 

Thank you very much for your reply!

I’ve supplied the logs up until it prompts me for password. The following information is redacted: [gateway_id], [gateway_ip], [gateway_password], [server_ip].

I would really appreciate if the team can help me fix this. The password prompts get really annoying.

Okay, this problem is solved with a workaround suggested to my by GPT:

Cursor is forcing askpass (it sets SSH_ASKPASS, SSH_ASKPASS_REQUIRE=force, and a fake DISPLAY) and that breaks sshpass inside your ProxyCommand. You can keep using passwords; you just need to unset those env vars for the inner ssh.

The ssh config file is now:

Host [host_name]
  HostName [host_ip]
  User [host_id]
  ProxyCommand /usr/bin/env -u SSH_ASKPASS -u SSH_ASKPASS_REQUIRE -u DISPLAY sshpass -p [YOUR_GATEWAY_PASSWORD] ssh -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no -o NumberOfPasswordPrompts=1 [gateway_id]@[gateway_ip] -W %h:%p

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.