SSH from Windows PowerShell to Linux server fails to allocate Pseudo-Terminal; "stdin is not a terminal"

Problem

I want to work on code projects on my linux droplet in digital ocean by loading the remote folder using Visual Studio Code's remote SSH plugin.

In the interim, I'm trying to verify that powershell can connect to SSH so that I can then troubleshoot on VSCode.

Background

  • Client is Windows 10 Home
  • Remote is Ubuntu 20.04
  • ssh is at C:\Windows\System32\OpenSSH\ssh.exe and is in the path
  • WSL on the same machine works fine with ssh to the remote machine

SSH Setup and Issues

I have run these commands:

PS> Get-Service -Name ssh-agent | Set-Service -StartupType Automatic
PS> Start-Service ssh-agent
PS> ssh-add C:\path\wsl\folder\private.key
Enter passphrase for C:\path\wsl\folder\private.key:
Identity added: C:\path\wsl\folder\private.key (myserver.com)

Running SSH generates a stream of Pseudo-terminal errors:

PS> ssh
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
...

Running ssh with -T, -T -t, and -tt yields the same result. This occurs on both powershell 5 and 6, regardless of administrator status.

I am not able to run any commands on the remote machine in this state, and there is no indication that a connection has been established.

Question

How can I connect via ssh from my windows machine to my linux droplet?

1 Answer

Fixed this by adding RequestTTY Yes to the ssh config file. This file is stored at %USERPROFILE%\.ssh\config by default on windows for Win32-OpenSSH.

This is my current ssh config:

Host myserver.com HostName myserver.com User me RequestTTY Yes

This also resolved my problem with getting Visual Studio Code to load a remote coding project.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like