Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestTTY does not modify the -T flag #6078

Closed
vincent-van-hoef opened this issue Dec 17, 2021 · 15 comments
Closed

RequestTTY does not modify the -T flag #6078

vincent-van-hoef opened this issue Dec 17, 2021 · 15 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) ssh Issue in vscode-remote SSH

Comments

@vincent-van-hoef
Copy link

The default ssh command from the extension seems to be fixed to ssh -T .... Changing the RequestTTY options in the ssh config file to one of "yes", "no", "auto" or "force" does not change the flag (I'm under the impression it should; might be wrong here).

As a consequence I get a Pseudo-terminal will not be allocated because stdin is not a terminal. error. Running the ssh command manually with the -t flag does connect me to the server.

Seems to be referenced before here: #5683

Thanks!

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Dec 17, 2021
@tanhakabir
Copy link

To clarify:

Running the ssh command manually with the -t flag does connect me to the server.

This means if you use terminal or PowerShell, you're able to connect to the remote with a -t flag but not -T?

@tanhakabir tanhakabir added info-needed Issue requires more information from poster feature-request Request for new features or functionality and removed feature-request Request for new features or functionality labels Dec 17, 2021
@vincent-van-hoef
Copy link
Author

vincent-van-hoef commented Dec 17, 2021

Sorry, that was a bit unclear. Indeed, connecting from a terminal to the remote server with -t works, while -T results in the same error about the pseudo terminal.

@tanhakabir
Copy link

Sorry I realize I had forgotten to reply here.

With -T we're preventing the remote from allocating pseudo terminals. We need to do this to ensure that the VS Code server is set up properly on the remote.

With -t you're actually requesting for the remote to use a pseudo terminal. Does your server then need pseudo terminals to successfully connect and interact with them? What happens if you don't set -T nor -t?

@heroboy
Copy link

heroboy commented Feb 10, 2022

I have same issue. I can't connect with '-T'.
Here is the output

[14:34:35.259] Log Level: 1
[14:34:35.262] remote-ssh@0.70.0
[14:34:35.262] win32 x64
[14:34:35.263] SSH Resolver called for "ssh-remote+20.0.0.229", attempt 1
[14:34:35.264] "remote.SSH.useLocalServer": false
[14:34:35.267] "remote.SSH.showLoginTerminal": true
[14:34:35.268] "remote.SSH.remotePlatform": {}
[14:34:35.268] "remote.SSH.path": undefined
[14:34:35.268] "remote.SSH.configFile": undefined
[14:34:35.268] "remote.SSH.useFlock": true
[14:34:35.269] "remote.SSH.lockfilesInTmp": false
[14:34:35.269] "remote.SSH.localServerDownload": auto
[14:34:35.269] "remote.SSH.remoteServerListenOnSocket": false
[14:34:35.270] "remote.SSH.showLoginTerminal": true
[14:34:35.270] "remote.SSH.defaultExtensions": []
[14:34:35.270] "remote.SSH.loglevel": 1
[14:34:35.271] "remote.SSH.serverPickPortsFromRange": {}
[14:34:35.271] "remote.SSH.enableDynamicForwarding": true
[14:34:35.271] "remote.SSH.serverInstallPath": {}
[14:34:35.272] SSH Resolver called for host: 20.0.0.229
[14:34:35.272] Setting up SSH remote "20.0.0.229"
[14:34:35.311] Using commit id "d6ee99e4c045a6716e5c653d7da8e9ae6f5a8b03" and quality "stable" for server
[14:34:35.315] Install and start server if needed
[14:34:36.840] Checking ssh with "ssh -V"
[14:34:36.876] > OpenSSH_for_Window
[14:34:36.876] > s_8.1p1, LibreSSL 3.0.2

[14:34:36.880] Remote command length: 6110/8192 characters
[14:34:36.880] Running script with connection command: ssh -T -D 57648 "20.0.0.229" powershell
[14:34:36.883] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[14:34:37.319] "install" terminal received data: "�[2J�[m�[H�]0;C:\WINDOWS\System32\cmd.exe��[?25h"
[14:34:37.319] Got some output, clearing connection timeout
[14:34:37.342] "install" terminal received data: "�[25l�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K
�[K�[H�[?25h"

And here is what happened when connect in the command line:


C:\Users\heroboy\.ssh>ssh -T 20.0.0.229
WHrCg@b g

@tanhakabir tanhakabir added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Mar 16, 2022
@tanhakabir tanhakabir self-assigned this Mar 16, 2022
@pedroilidio
Copy link

pedroilidio commented Apr 18, 2022

I have the same issue here. My use case is that I want to be able to automatically attach to a screen after connecting to the host, which I could perfectly achieve outside vscode with the settings:

Host myhost
    HostName <myhost>
    User <myuser>
    RequestTTY force
    RemoteCommand screen -Dr vscode

So that ssh myhost works, while ssh -T myhost does not.

@tanhakabir tanhakabir assigned roblourens and unassigned tanhakabir Sep 2, 2022
@maxencefaldor
Copy link

I have the same issue here, I would like to use tmux with the following ssh config file:

Host host
HostName
User
RemoteCommand tmux new-session -As project
RequestTTY force

but VSCode connects using: ssh -v -T -D 52289 -o ConnectTimeout=15 host
instead of using -t flag, resulting in an error.

How can I change the behavior of VSCode to connect using : ssh -v -t -D 52289 -o ConnectTimeout=15 host
which works?

@SouthOfAsia
Copy link

I am experiencing the same issue. I want to use VSCode to connect to my server,which system is Windows Server 2012.
When I use ssh -T Administrator@xxx.xxx.xx.xx, the shell returns WHrCg@b g.
However, when I use ssh Administrator@xxx.xxx.xx.xx, it returns the correct output. I believe that the -T option might have confused me.

@SouthOfAsia
Copy link

I am experiencing the same issue. I want to use VSCode to connect to my server,which system is Windows Server 2012. When I use ssh -T Administrator@xxx.xxx.xx.xx, the shell returns WHrCg@b g. However, when I use ssh Administrator@xxx.xxx.xx.xx, it returns the correct output. I believe that the -T option might have confused me.

Is not ‘-t’ makes error
I update my Server‘s Powershell Version 4.0 to 5.0 and it works.

@adamfitz
Copy link

I am experiencing the same issue, where I am not able to open a remote ssh session to my target server (linux) because vscode is forcing the use of the -T flag.

I tested the following connection string from my client and confirmed I get the same connection error as I get when testing from vscode:

"C:\windows\System32\OpenSSH\ssh.exe" -T -D 61757 "$target_server"

When I remove the -T flag the connection works as expected.

Also I can see the ssh config parameters RemoteCommand and RequestTTY are simply ignored by vscode so I am unable to use this as a workaround.

Is there any option/setting to allow the user to change this behavior and remove the -T flag from the connection string or force a TTY as a workaround?

@paperclover
Copy link

haven't verified but a potential way to reproduce this may be to install debian 12.2 and switch your user's shell to fish, ssh -T no longer works on that user.

is there a reason we cannot make -T vs -t configurable, and also detect a hang to make this error easier for users to deal with.

@jcarpinelli-bdai
Copy link

I see RemoteCommand is experimentally supported. That's great! I hope it is possible to add RequestTTY support as well. Some shells, like nushell, require TTY. Right now, to use non-standard shells like nushell, I believe users can also disable the "Use Local Server" option of the Remote SSH extension; that seems to cause VSCode to request a TTY for each terminal.

@YourGraceQI
Copy link

I am facing the same issue, while vs remote ssh keep adding the -T flag, adding RequestTTY doesn't help, and RemoteCommand also do nothing, anyone can help?

@iamsiita
Copy link

vscode keeps adding -T flag even after adding RequestTTY force.
vscode continues to add -T flag even if the "Use Local Server" option is turned off.
Is there a way to disable the -T flag? If not, will it be added in the future?

@ManiaciaChao
Copy link

ManiaciaChao commented Aug 15, 2024

Same here. My case is to connect to a server which is bebind a jump server, with option ProxyJump
ssh hostname works but not for ssh -T hostname.

However I don't think this is an issue because there's option to turn off this behavior:

  "remote.SSH.permitPtyAllocation": true

@roblourens
Copy link
Member

I think this issue is a dupe of #7558 (comment) that I didn't realize we had. Yes, that new setting is right, please try it out and give feedback in the other issue, thanks

@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 15, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests