warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.52k stars 376 forks source link

Cannot connect to Windows (10/11/Server) via SSH #2413

Open Molin-L opened 1 year ago

Molin-L commented 1 year ago

Discord username (optional)

No response

Describe the bug

I want to login to my windows computer through SSH. Here is how I setup my Windows SSH server: https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell

After all setup, I tried to login to my Windows using Warp. I successfully login to my computer then the session end.

Screenshot 2022-12-28 at 9 37 21 AM

It works totally fine on my default terminal.app, but Warp not working.

To Reproduce

  1. Setup a Windows SSH Server;
  2. Try to login;

Expected behaviour

No response

Screenshots

No response

Operating System

MacOS

OS Version

13.1 (22C65)

Shell Version

zsh 5.8.1 (x86_64-apple-darwin22.0)

Warp Version

v0.2022.12.13.08.04.stable_01

Additional context

No response

Does this block you from using Warp daily?

Yes, this issue prevents me from using Warp daily.

Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e

None

dannyneira commented 1 year ago

Thank you, @Molin-L, for your input!

We will keep you updated on any developments regarding this issue through this thread.

Also, as @osmboy mentioned, you can workaround this issue by installing installing Cygwin on the Windows machine you'd like to connect to.

If the above workaround isn't helping, you can disable the SSH wrapper by navigating to Settings > Features. This will allow SSH to function normally, although it may disable Blocks functionality.

In the meantime, if you're experiencing the same issue, please consider adding a 👍 to the original post at the top or commenting with your details. Your contribution will help us understand the extent of the issue. Additionally, if you would like to receive notifications about any updates related to this issue, please click on the subscribe button.

Thank you for your understanding and patience as we work towards resolving this issue.

junukwon7 commented 1 year ago

Same here. It says:

$ ssh user@host
'export' is not recognized as an internal or external command,
operable program or batch file.
Connection to host closed.
osmboy commented 1 year ago

workaround: you can install cygwin on windows then ssh

gordon8214 commented 1 year ago

This fix is not working for me. I have Cgywin installed and from the Terminal app, I can SSH and invoke bash with no issue. However, when I try to connect from Warp, The following error flashes for a split second before the connection drops:

~
Missing '(' after 'if' in if statement.
0smboy commented 1 year ago

This fix is not working for me. I have Cgywin installed and from the Terminal app, I can SSH and invoke bash with no issue. However, when I try to connect from Warp, The following error flashes for a split second before the connection drops:


~

Missing '(' after 'if' in if statement.

This error is probably thrown by powershell. You may have to disable windows own openssh server and then configure and start ssh daemon on cygwin

zachbai commented 1 year ago

Hey @gordon8214 -- the issue is most likely that Warp's ssh wrapper is being invoked and attempting to 'Warpify' the SSH session -- which won't work because Warp doesn't currently support Powershell.

You can circumvent Warp's ssh wrapper by prefixing command to your ssh command, e.g.

command ssh user@host

Or you can disable Warp's SSH wrapper altogether in the 'Features' settings page: image

galvesribeiro commented 1 year ago

Just leaving a comment to let you know it is not only on Windows Server. This happen on Windows 11 as well.

MichaelCharles commented 1 year ago

I'm here to report that I too am having this problem. Attempting to ssh from a Macbook to Windows 11. Here's the permalink to the command execution/output: https://app.warp.dev/block/kmiRSX8mEllNVdFZ0u3AIw

JKuhn commented 1 year ago

Alternatively, you can also switch to using another shell without the warp wrapper and then connect:

$ zsh
$ ssh user@windows.host

After switching to zsh (or whatever shell you prefer) Warp asks in the UI whether you want to wrap that shell, just ignore it.

aslan-im commented 8 months ago

Is there any date when this is going to be resolved?

hd719 commented 5 months ago

Hi, any update on this?

T1murKO commented 3 months ago

+1 mac to windows ssh

ai1urus commented 2 months ago

Same here. It says:

$ ssh user@host
'export' is not recognized as an internal or external command,
operable program or batch file.
Connection to host closed.

same output. ssh with macOS native terminal works fine.

it seems like warp will export some environment parameters to ssh server but windows powershell does not support this kind of shell command?

dezerving commented 4 weeks ago

Since we're tracking all SSH on Windows issues here, let me post the output that I am getting when trying to SSH into a Windows 11 host from Mac OS. I believe users in #1729 and #2027 were experiencing the same behavior or something similar.

❯ ssh windows

At line:5 char:3
+ if test ${SHELL##*/} != bash -a ${SHELL##*/} != zsh; then
+   ~
Missing '(' after 'if' in if statement.
At line:6 char:4
+  if test ! -e $HOME/.hushlogin; then
+    ~
Missing '(' after 'if' in if statement.
At line:7 char:4
+  if test -r /etc/motd; then
+    ~
Missing '(' after 'if' in if statement.
At line:19 char:4
+  if test -r /etc/profile; then
+    ~
Missing '(' after 'if' in if statement.
At line:25 char:6
+  bash)
+      ~
Unexpected token ')' in expression or statement.
At line:35 char:35
+  printf '\''\eP$d%s\x9c'\'' $_msg'
+                                   ~
Missing closing ')' in expression.
At line:26 char:29
+  exec -a bash bash --rcfile <(echo '
+                             ~
The '<' operator is reserved for future use.
At line:37 char:2
+  )
+  ~
Unexpected token ')' in expression or statement.
At line:39 char:5
+  zsh) WARP_TMP_DIR=$(command -p mktemp -d warptmp.XXXXXX)
+     ~
Unexpected token ')' in expression or statement.
At line:42 char:4
+  if [[ $? == 0 ]]; then
+    ~
Missing '(' after 'if' in if statement.
Not all parse errors were reported.  Correct the reported errors and try
again.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordE
   xception
    + FullyQualifiedErrorId : MissingOpenParenthesisInIfStatement

Connection to windows closed.

As JKuhn mentioned, using a non-warpified ZSH works just fine.

❯ zsh
❯ ssh windows
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\user>