zed icon indicating copy to clipboard operation
zed copied to clipboard

Zed remote development fails to connect to Dockerized SSH server

Open binjamil opened this issue 7 months ago • 2 comments

Summary

Zed remote development fails to connect to SSH server, while I'm able to login to SSH server manually in terminal via ssh command.

Description

I have docker container running Ubuntu 20.04 that is accepting SSH connections. Container's 22 port is forwarded to host's 2222 port. I can login to this server by running ssh gradeuser@localhost -p 2222 successfully. Even VS Code's remote development server is working normally when connecting to the same SSH server.

On zed v0.186.9, when I enter the above exact command into remote development prompt, I get the following error:

Failed to connect
failed to run command: 
/usr/local/sbin/ssh_wrapper.sh: line 14: cd;: command not found Connection to localhost closed by remote host. . Please try again.

Here is the sss_wrapper.sh file for reference:

#!/bin/bash
# This script is used to terminate the container after the user logs out.

case $SSH_ORIGINAL_COMMAND in
scp*)
    ${SSH_ORIGINAL_COMMAND}
    ;;
*sftp*)
    ${SSH_ORIGINAL_COMMAND}
    ;;
*)
    cat /etc/motd
    cd /autograder
    ${SSH_ORIGINAL_COMMAND:-$SHELL}

    # Kill sshd after logging out
    pkill sshd
    ;;
esac

Steps to reproduce:

  1. Set up a docker container running Ubuntu 20.04
  2. In container, run sshd and expose port 22 to host machine
  3. Test if you can login into SSH server using ssh command
  4. Try to login into SSH server via Zed's remote development

Expected Behavior: Should login into SSH server Actual Behavior: Throws some weird error, which I haven't been able to resolve even after tweaking ssh_wrapper.sh file

Zed Version and System Specs

Zed: v0.186.9 (Zed) OS: Linux Wayland endeavouros unknown Memory: 31 GiB Architecture: x86_64 GPU: Intel(R) Arc(tm) A370M Graphics (DG2) || Intel open-source Mesa driver || Mesa 25.0.5-arch1.1

binjamil avatar May 17 '25 14:05 binjamil

Can you update the issue title to specifically say that it's about a docker container? From the description it sounds like it likely is specific to that scenario.

jansol avatar May 20 '25 12:05 jansol

Can you update the issue title to specifically say that it's about a docker container? From the description it sounds like it likely is specific to that scenario.

Done!

I was able to connect after I removed the ssh wrapper file. However, this is still a bug since it should be able to connect with ssh wrapper too. I was certainly able to connect via ssh from terminal and via vscode when ssh wrapper was present

binjamil avatar May 26 '25 16:05 binjamil