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

docs: Add WinSCP troubleshooting step and tsh.exe path advice #42697

Merged
merged 9 commits into from
Jun 11, 2024
42 changes: 42 additions & 0 deletions docs/pages/connect-your-client/putty-winscp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ You will learn how to:

You should then unzip the archive and move `tsh.exe` to your `%PATH%`.

<Admonition type="note">
Do not place `tsh.exe` in the `System32` directory, as this can cause issues when using WinSCP.
You should use `%SystemRoot%` (e.g. `C:\Windows`) instead, which is already included in `%PATH`.

If you do not have administrator rights on the Windows system you're using, you can use `%USERPROFILE%`
(e.g. `C:\Users\<username>`) instead - but note that you will not be able to run `tsh` commands globally
from the command line unless you are in the same directory as `tsh.exe`.
</Admonition>

- PuTTY for Windows version 0.78 or higher. You can download the latest version of PuTTY from the [PuTTY download page](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html).

- (optional) WinSCP for Windows version 6.2 or higher. You can download the latest version of WinSCP from the [WinSCP download page](https://winscp.net/eng/download.php)
Expand Down Expand Up @@ -284,13 +293,37 @@ key. Note that if you re-run `tsh puttyconfig` for the given hostname, this comm

## Troubleshooting

### WinSCP shows `Server unexpectedly closed network connection` or `Error 232: The pipe is being closed` when connecting

This error is usually caused when the `tsh.exe` application is incorrectly placed in the `C:\Windows\System32` directory. This
triggers a bug in WinSCP which causes the path to `tsh.exe` to be erroneously replaced at runtime, leading to a connection
failure. This bug does not seem to affect PuTTY sessions.

Here are two locations where `tsh.exe` can be stored which are not affected by this bug:
- `%USERPROFILE` (e.g. `C:\Users\<username>` - does not require administrator privileges)
- `%WINDIR%` (e.g. `C:\Windows` - requires administrator privileges)

To fix this issue, follow these steps:
1. Place the `tsh.exe` application into a different directory, as detailed above.
1. Re-run `tsh puttyconfig` for each PuTTY session in order to replace the configured path to `tsh.exe` inside the session.
1. Delete each saved session inside WinSCP.
1. Re-import saved PuTTY sessions into WinSCP by following the process detailed in steps 2-3 above.

### `proxy: ERROR: access denied to <user> connecting to <proxy>`

You have provided an incorrect login username to the `tsh puttyconfig` command. Re-run the command with a login username
that your Teleport user/role has permissions to use. Check the logins listed under the `logins` role specification or user trait.

If you can log in successfully with `tsh ssh`, you should be able to use the name login/hostname with `tsh puttyconfig`.

### `Connect failed [ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain]`

You have provided an incorrect login username to the `tsh puttyconfig` command when attempting to connect to an OpenSSH server.
Re-run the command with a login username that your Teleport user/role has permissions to use. Check the logins listed under the
`logins` role specification or user trait.

If you can log in successfully with `tsh ssh`, you should be able to use the name login/hostname with `tsh puttyconfig`.

### `proxy: ERROR: ssh: subsystem request failed`

The Teleport proxy is unable to connect to the given host/port provided in the saved session. This may mean that the node is
Expand All @@ -300,6 +333,15 @@ successful, check the Teleport proxy logs for more detailed errors.
If the node is running OpenSSH rather than Teleport, you must make sure to specify the `sshd` port when adding the session,
for example using `tsh puttyconfig --port 22 user@host` or `tsh puttyconfig user@host:22`.

### `proxy: direct dialing to nodes not found in inventory is not supported`

This error usually means that you registered an agentless OpenSSH host (i.e. a host running sshd) without also providing the
port while running `tsh puttyconfig`. Try re-adding the host with the correct port (22 in this example) by using
`tsh puttyconfig --port 22 user@host`.

If you still get this error after fixing the port, make sure that the host you are trying to connect to appears in the output
of `tsh ls`. Hostnames which do not appear in the output of `tsh ls` are unavailable for connection.

### `Unable to use certificate file "C:\Users\<username>\.tsh\keys\<proxy>\<user>-ssh\<cluster>-cert.pub" (unable to open file)`

You are not logged into Teleport correctly. Run `tsh login --proxy=<proxy hostname>` to get valid certificates before
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/includes/install-tsh.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Tabs>
<TabItem label="Mac">
Download the signed macOS .pkg installer for `tsh`. In Finder double-click the `pkg` file to install it:

```code
$ curl -O https://cdn.teleport.dev/tsh-(=teleport.version=).pkg
```
Expand All @@ -28,6 +28,8 @@
```code
$ curl.exe -O https://cdn.teleport.dev/teleport-v(=teleport.version=)-windows-amd64-bin.zip
# Unzip the archive and move `tsh.exe` to your %PATH%
# NOTE: Do not place tsh.exe in the System32 directory, as this can cause issues when using WinSCP.
# Use %WINDIR% (C:\Windows) or %USERPROFILE% (C:\Users\<username>) instead.
```
</TabItem>

Expand Down
5 changes: 5 additions & 0 deletions docs/pages/includes/install-windows-clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@
```

Make sure to move `tsh.exe` and `tctl.exe` into your PATH.

<Admonition type="note">
Do not place `tsh.exe` in the `System32` directory, as this can cause issues when using WinSCP.
You should use `%WINDIR%` (e.g. `C:\Windows`) or `%USERPROFILE%` (e.g. `C:\Users\<username>`) instead.
</Admonition>
2 changes: 1 addition & 1 deletion docs/pages/server-access/guides/jetbrains-sftp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $ ssh user@[server name].[cluster name]
$ ssh -p 22 user@[server name].[cluster name]
```
</Admonition>

## Step 2/3. Configure your JetBrains IDE

After opening your IDE go to `Tools` -> `Deployment` -> `Browse Remote Host`.
Expand Down
Loading