Ssh.exe cannot be used if the agent is deployed via sshd

Hi

We have just deployed Jenkins 2.361.1. We want to use agents on Windows Core servers via SSH.
The agent deployment is working fine and we can run operations from pipelines. However, as soon as we request the ssh command from the agent, the pipeline is blocked and does not move forward.

Here is the pipeline code.

pipeline {
agent none
stages {
stage(‘test SSH’) {
agent {
node {
label ‘wincore’
}
}
steps {
script {
pwsh “”"
Get-ChildItem env:
ping git.mynetwork.fr
ssh.exe -n -T git.mynetwork.fr
“”"

  			}
        }
  	post {
  		success {
  		echo "success"
  		}
  		failure {
  		echo "failure"
  		}
  		always {
  		echo "Nettoyage du repertoire de travail."
  		cleanWs notFailBuild: true
  		}
  	}
  }
  
  }

}

All works until the command “ssh.exe -n -T”

From this moment, the pipeline blocks, without any error. Nothing happens anymore.
We have no logs, no errors. When we connect (with the same service account as the agent) and type the command "ssh.exe " directly on the windows server where the agent is running, the command works very well.

We do not understand where the blocking comes from. The call to the executable ssh.exe does not succeed from a pipeline. If the agent is deployed via a windows service without using sshd, we don’t have the problem.

Command line ssh is probably waiting for input. You need to find the command line arguments to ssh that will tell it to not wait for input.

Could be that its waiting for you to accept the host key for instance, are your known_hosts setup on the agents for the system that you are connecting to?

Also, are you using public key authentication to connect to the agent via SSH? The reason I ask is because the connection is not a full session if you use public key authentication to connect to the agent.