首页 文章

从linux到Windows的ssh工作只能通过密码,而不是密钥

提问于
浏览
-1

在我的目标场景中,我需要从linux远程连接到Windows并执行powershell命令 . 为此,我在Windows上安装了本机开放ssh服务器,在两台机器上安装了pwoershell core 6 .

如果我在sshd上使用密码验证,远程处理工作正常 . 当需要基于密钥的身份验证时,它不起作用 .

PS /> Enter-PSSession -HostName computername -UserName 'domain\username' -KeyFilePath ./sshkeys/win/win10 -Verbose
Enter passphrase for key '/sshkeys/win/win10':
Enter-PSSession : The background process reported an error with the following message: The SSH client session has ended with error message: Connection to computername closed by remote host..
At line:1 char:1
+ Enter-PSSession -HostName computername -UserName 'domain\username' -KeyFilePath ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (:) [Enter-PSSession], PSRemotingTransportException

有人知道这可能导致错误吗?

1 回答

  • 0

    对于任何有兴趣的人,我通过进一步研究解决了这个问题 .

    命令/设置完全没问题,但是我使用“Add-WindowsCapability”cmdlet安装的软件包中包含open ssh服务器版本的一个突出问题 .

    这个捆绑包在我的Win10机器上安装了7.6p1-beta版本 . 但是事实上这个问题已经在7.6.1p1-beta中得到修复,请参阅:https://github.com/PowerShell/Win32-OpenSSH/issues/1098

    手动下载并运行最新版本的SSH Server为我修复了它 .

相关问题