VSCode remote SSH: no unix session - visual-studio-code

I have a development server that only enables the HTTP server while I have an active session on it. The connection is configured in ~/.ssh/config, and VSCode uses this for the remote session as well:
Host devserver
HostName <hostname>
User <username>
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
In VSCode I use the default settings for Remote SSH, when first connecting to the remote, only the platform was set:
{
"remote.SSH.remotePlatform": {
"devserver": "linux"
},
}
Through a regular terminal, when I SSH into the server and issue the w command, I get:
14:26:23 up 343 days, 23:53, 1 user, load average: 4.45, 4.65, 3.93
USER TTY FROM LOGIN# IDLE JCPU PCPU WHAT
username pts/0 ip-address 14:26 1.00s 0.05s 0.00s w
However, if I start a VSCode Remote-SSH session to the server, my HTTP server doesn't get started. If I issue the w command in the VSCode terminal, the table is empty:
14:28:27 up 343 days, 23:55, 0 users, load average: 4.59, 4.67, 4.04
USER TTY FROM LOGIN# IDLE JCPU PCPU WHAT
Is there a way to start a login session from VSCode when remote-developing on the server?

Related

vscode remote-ssh fails

Local: macOS 12.6, vscode1.72.2, remote-ssh v0.90.1 preview
Server: Tencent Cloud Lightweight Server centOS7.6
Server ssh configuration is set: AllowTcpForwarding yes
The local command line ssh connection server can be entered normally.
The error message is:
channel 2: open failed: administratively prohibited: open failed

Can't connect remote-ssh VSCode - No Kerberos credentials available

I installed remote-ssh plugin in my VSCode in an Ubuntu machine and I got a problem connecting to the remote server. The password prompt didn't appear and I couldn't enter my ssh passphrase and I suspect that's why the connection failed. Any advice? Thanks
[21:29:18.094] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-43be30dd59b7e1cc43e3ac15496de2994552e19d.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","34635","-o","ConnectTimeout=15","pipeline-azure-2.nplan.io"],"dataFilePath":"/home/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-pipeline-azure-2.nplan.io-c3f126316369cd610563c75b1b1725e0679adfb3-0.65.7/data.json"}
[21:29:18.094] Local server env: {"DISPLAY":":0","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/70/usr/share/code/code","VSCODE_SSH_ASKPASS_MAIN":"/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-4ae6bcfc1164348347c6920b3ec572ba3eba795f.sock"}
[21:29:18.105] Spawned 239369
[21:29:18.301] > local-server-1> Spawned ssh, pid=239378
[21:29:18.305] stderr> OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f 31 Mar 2020
[21:29:23.099] stderr> debug1: Server host key: ssh-rsa SHA256:BJdFW33L3iusC5rckbrC9WmH7+dx5W1mC6VkyAsCFbs
[21:29:33.762] stderr> No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
[21:29:33.762] stderr>
[21:29:33.762] stderr>
[21:29:35.107] Terminating local server
[21:29:35.111] Resolver error: Error: Connecting with SSH timed out
at Function.Timeout (/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:64785)
at Timeout._onTimeout (/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:264709)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
[21:29:35.124] ------
I just deleted the .vscode-server folder on the server and voila!
Credits to: https://github.com/microsoft/vscode-remote-release/issues/3856#issuecomment-710733921

"Connection timed out" error while connecting vscode to gcloud cloud shell

I have set up the cloud shell for vscode as given in this document; however it stopped connecting to the remote shell and it was only connected once initially. No VS Code version change happened. Current VSCode version is 1.46.1
Following are the logs thrown -
[13:31:22.078] Log Level: 2
[13:31:22.086] remote-ssh#0.51.0
[13:31:22.086] win32 x64
[13:31:22.093] SSH Resolver called for "ssh-remote+cloud-shell", attempt 1
[13:31:22.094] SSH Resolver called for host: cloud-shell
[13:31:22.094] Setting up SSH remote "cloud-shell"
[13:31:23.942] Using commit id "cd9ea6488829f560dc949a8b2fb789f3cdc05f5d" and quality "stable" for server
[13:31:23.945] Install and start server if needed
[13:31:23.951] Checking ssh with "ssh -V"
[13:31:23.957] Got error from ssh: spawn ssh ENOENT
[13:31:23.958] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[13:31:23.962] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT
[13:31:23.962] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[13:31:28.385] > OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020
[13:31:28.390] Running script with connection command: "C:\Program Files\Git\usr\bin\ssh.exe" -T -D 50396 cloud-shell bash
[13:31:28.412] Terminal shell path: C:\Windows\System32\cmd.exe
[13:31:33.205] >
[13:31:33.206] Got some output, clearing connection timeout
[13:31:54.348] > ssh: connect to host 34.87.29.174 port 6000: Connection timed out
>
[13:31:54.764] "install" terminal command done
[13:31:54.765] Install terminal quit with output: ssh: connect to host 34.87.29.174 port 6000: Connection timed out
[13:31:54.766] Received install output: ssh: connect to host 34.87.29.174 port 6000: Connection timed out
[13:31:54.768] Resolver error: The connection timed out
[13:31:54.781] ------

Successfully installed vs code server on remote host, but it's still trying to install something

I have successfully installed vs code server on the remote host following the steps here SSH with VSCode without internet.
Now when I ssh into the remote host, I can connect successfully and start working, but in the install terminal, it's still trying to install something, not sure if it's an extension on the remote host that I wanted to install earlier and later successfully installed with vsix. See the log from remote - ssh below, further down there's also output from the install terminal which shows a small bar moving, seemingly indicating progress of something.
How can I stop it from doing this every time I connect to the host? Thank you!!
[11:58:58.011] remote-ssh-nightly#2019.10.9540
[11:58:58.011] win32 x64
[11:58:58.013] SSH Resolver called for "ssh-remote+<hostname>", attempt 1
[11:58:58.013] SSH Resolver called for host: <hostname>
[11:58:58.013] Setting up SSH remote "<hostname>"
[11:58:58.028] Using commit id "<mycommitid>" and quality "stable" for server
[11:58:58.029] Testing ssh with ssh -V
[11:58:58.287] ssh exited with code: 0
[11:58:58.287] Got stderr from ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[11:58:58.290] Running script with connection command: ssh -T -D 61671 <hostname> bash
[11:58:58.292] Install and start server if needed
[11:58:58.295] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[11:58:58.639] >
[11:58:58.639] Got some output, clearing connection timeout
[11:58:59.616] > 6c2c07692b2a: running
>
[11:58:59.677] > Acquiring lock on /users/<myuserid>/.vscode-server/bin/<mycommitid>/vscode-remote-lock.<mycommitid>
> Found existing installation at /users/<myuserid>/.vscode-server/bin/<mycommitid>...
>
[11:58:59.718] > Found running server...
>
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
>
>
[11:58:59.739] > Checking server status on port 32772 with wget
> 6c2c07692b2a: start
> sshAuthSock====
> agentPort==32772==
> webViewServerPort====
> osReleaseId==centos==
> arch==x86_64==
> webUiAccessToken====
> 6c2c07692b2a: end
>
[11:58:59.739] Received install output:
sshAuthSock====
agentPort==32772==
webViewServerPort====
osReleaseId==centos==
arch==x86_64==
webUiAccessToken====
[11:58:59.740] Remote server is listening on port 32772
[11:58:59.740] Parsed server configuration: {"agentPort":32772,"osReleaseId":"centos","arch":"x86_64","webUiAccessToken":"","sshAuthSock":""}
[11:58:59.741] Starting forwarding server. localPort 61674 -> socksPort 61671 -> remotePort 32772
[11:58:59.742] Forwarding server listening on 61674
[11:58:59.742] Waiting for ssh tunnel to be ready
[11:58:59.750] [Forwarding server 61674] Got connection 0
[11:58:59.755] Tunneled remote port 32772 to local port 61674
[11:58:59.756] Resolved "ssh-remote+<hostname>" to "127.0.0.1:61674"
[11:58:59.756] TELEMETRY: {"eventName":"resolver","properties":{"outcome":"success","osReleaseId":"centos","arch":"x86_64","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0"},"measures":{"resolveAttempts":1,"retries":1}}
[11:58:59.756] ------
[11:58:59.784] [Forwarding server 61674] Got connection 1
[11:58:59.789] [Forwarding server 61674] Got connection 2
[12:01:59.722] >
[12:04:59.733] >
[12:07:59.744] >
Below is the output on the install terminal. At the end of this output, there's a small bar moving very slowly like a progress bar.
6c2c07692b2a: running
Acquiring lock on /users/<myuserid>/.vscode-server/bin/<commitid>/vscode-remote-lock.<commitid>
Found existing installation at /users/<myuserid>/.vscode-server/bin/<commitid>...
Found running server...
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
*
Checking server status on port 32772 with wget
6c2c07692b2a: start
sshAuthSock====
agentPort==32772==
webViewServerPort====
osReleaseId==centos==
arch==x86_64==
webUiAccessToken====
6c2c07692b2a: end

How to use non 22 ssh port in visual studio code insiders remote developments?

ssh login by authentication is working fine.
C:\Users\${DEVELOPER_NAME}>ssh ${HOST_IP_ADDRESS} -l ${DEVELOPER_NAME} -p ${SSHD_PORT} -i D:\prefix\PuTTY\${OPENSSH_FORMAT_PRIVATE_KEY}
Last login: Sun May 5 15:27:50 2019 from 10.40.171.44
Welcome to ...
[${DEVELOPER_NAME}#${HOST_AKA} ~]$
but sshd is running on 36000 not default 22 port, how can I tell that to vs code remote-ssh plugin
Host ${DEVELOPER_NAME}#${HOST_IP_ADDRESS}
HostName ${HOST_IP_ADDRESS}:${SSHD_PORT}
User ${DEVELOPER_NAME}
Port ${SSHD_PORT}
IdentityFile D:\prefix\PuTTY\${OPENSSH_FORMAT_PRIVATE_KEY}
this way gives me
Can't connect to ${DEVELOPER_NAME}#${HOST_IP_ADDRESS}: unreachable or not Linux x86_64 (ssh: connect to host ${HOST_IP_ADDRESS} port 22: Connection refused)
and
${DEVELOPER_NAME}#${HOST_IP_ADDRESS}:${SSHD_PORT}
in Remote-SSH: Connect to Host... gives me
Can't connect to ${DEVELOPER_NAME}#${HOST_IP_ADDRESS}:${SSHD_PORT}: unreachable or not Linux x86_64 (ssh: Could not resolve hostname ${HOST_IP_ADDRESS}:${SSHD_PORT}: Name or service not known)
Thanks to your question, I solved it. You may have already figured it out ... You do not need to add a port for HostName. Just write Port and it works.
Host ${HOST_NICKNAME}
User ${USER_ID_HOST}
HostName ${HOST_IP_ADDRESS}
Port ${SSHD_PORT}
IdentityFile ~/.ssh/id_rsa-remote-ssh