我的 OpenSSH 服务器拒绝所有登录尝试,无论密钥文件、密码等是什么,都返回“权限被拒绝”。在 Windows 主机上以调试模式启动时,服务器打印
PS C:\Users\someguy\Documents\PowerShell> sshd.exe -d
debug1: sshd version OpenSSH_for_Windows_7.7, LibreSSL 2.6.5
....
debug1: KEX done [preauth]
debug1: userauth-request for user someguy service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
User domain\\someguy not allowed because shell c:\\program files\\powershell\\6\\pwsh.exe does not exist
我该如何解决这个问题?
答案1
安装后,SSHD 会将登录 shell 可执行文件的路径存储在注册表项中:
HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH
就我而言,c:\\program files\\powershell\\6\\pwsh.exe
升级 powershell core 会删除以前的版本,并使该 OpenSSH 条目无效。为了解决这个问题,我编辑了条目,用 替换了6
,7
然后重新启动了 sshd 服务器。远程访问已恢复。
恕我直言,Powershell 安装程序应该在继续之前打开一个模态对话框,警告删除操作。