yuvipanda / jupyterhub-ssh

SSH Access to JupyterHubs
BSD 3-Clause "New" or "Revised" License
94 stars 29 forks source link

Possible to use with VS Code's remote SSH-extension? #70

Open aurany opened 2 years ago

aurany commented 2 years ago

It would be really nice to use the VS Code extension "Remote SSH" to be able to connect to a users notebook. This requires that the ssh server accept TCP forwardig (like OpenSSH's sshd_config AllowTCPForwarding=yes). Is this possible to achieve with this package? I have tried but VS Code cannot, maybe due to TCP forwarding i'm not sure. Ideas?

yuhuishi-convect commented 2 years ago

I am looking into how to get the exact thing you describe to work. I think it might be due to the tunneling support -- #26

mkuziemko commented 2 years ago

@yuhuishi-convect do you manage to make it work with VS code?

I tried to use it with IntelliJ with the remote ssh plugin but it does not seem to work:

[asyncssh] [conn=8] Sending version SSH-2.0-AsyncSSH_2.7.0
[asyncssh] [conn=8] Received version SSH-2.0-IntelliJ__Gateway_GW-221.5921.22__SSHJ_0.32.0_idea2
[asyncssh] [conn=8] Requesting key exchange
[asyncssh] [conn=8] Received key exchange request
[asyncssh] [conn=8] Beginning key exchange
[asyncssh] [conn=8] Completed key exchange
[asyncssh] [conn=8] Beginning auth for user 
[asyncssh] [conn=8] Trying password auth
[asyncssh] [conn=8] Auth for user succeeded
[asyncssh] [conn=8] Received disconnect:  (11)
[asyncssh] [conn=9] Accepted SSH client connection
[asyncssh] [conn=9]   Local address: 127.0.0.1, port 8022
[asyncssh] [conn=9]   Peer address: 127.0.0.1, port 46554
[asyncssh] [conn=9] Sending version SSH-2.0-AsyncSSH_2.7.0
[asyncssh] [conn=9] Received version SSH-2.0-IntelliJ__Gateway_GW-221.5921.22__SSHJ_0.32.0_idea2
[asyncssh] [conn=9] Requesting key exchange
[asyncssh] [conn=9] Received key exchange request
[asyncssh] [conn=9] Beginning key exchange
[asyncssh] [conn=9] Completed key exchange
[asyncssh] [conn=9] Beginning auth for user 

[asyncssh] [conn=9] Trying password auth
[asyncssh] [conn=9] Auth for user  succeeded
[asyncssh] [conn=9, chan=0] Set write buffer limits: low-water=16384, high-water=65536
[asyncssh] [conn=9, chan=0] New SSH session requested
[asyncssh] [conn=9, chan=0]   Command: echo $SHELL
[asyncssh] [conn=9, chan=0] Received TERM signal
[asyncssh] [conn=9, chan=0] Received channel close
[asyncssh] [conn=9, chan=1] Set write buffer limits: low-water=16384, high-water=65536
[asyncssh] [conn=9, chan=1] New SSH session requested
[asyncssh] [conn=9, chan=0] Channel closed
[asyncssh] [conn=9] Closing connection
[asyncssh] [conn=9, chan=1] Closing channel
[asyncssh] [conn=9] Sending disconnect: Disconnected by application (11)
[asyncssh] [conn=9, chan=1] Closing channel due to connection close
[asyncssh] [conn=9, chan=1] Channel closed
Task exception was never retrieved
future: <Task finished name='Task-317' coro=<NotebookSSHServer._handle_stdin() done, defined at /srv/jupyterhub-ssh/jupyterhub_ssh/__init__.py:133> exception=SignalReceived('Signal: TERM')>
Traceback (most recent call last):
  File "/srv/jupyterhub-ssh/jupyterhub_ssh/__init__.py", line 144, in _handle_stdin
    data = await stdin.read(4096)
  File "/home/jovyan/.local/lib/python3.8/site-packages/asyncssh/stream.py", line 122, in read
    return await self._session.read(n, self._datatype, exact=False)
  File "/home/jovyan/.local/lib/python3.8/site-packages/asyncssh/stream.py", line 486, in read
    raise exc
asyncssh.misc.SignalReceived: Signal: TERM

Is it connected with the lack of support for tunneling? Perhaps, I could also take a look on it.