在 Windows Subsystem for Linux 中访问 Python 解释器,sshd_config 中出现错误?

在 Windows Subsystem for Linux 中访问 Python 解释器,sshd_config 中出现错误?

我在按照教程操作时遇到了问题如何通过 WSL 配置远程解释器对于 PyCharm。我的具体问题出现在本教程的先决条件部分。我通过了第 5 步,但第 6 步显示:

现在您已经在 Windows 系统上安装了 Linux,您必须编辑 ssh 配置文件 /etc/ssh/sshd_config:将字段 PasswordAuthentication 更改为 yes,将 UsePrivilegeSeparation 更改为 no。

但是,我的 sshd_config 文件不包含“UsePrivilegeSeparation”,而且我也没有看到示例图像中显示的几行(可能不相关的),例如“KeyRegenerationInterval”或“ServerKeyBits”。

无论我忽略此步骤还是尝试手动插入该行,我都会在步骤 8 中收到错误。当我运行“sudo $(sudo which sshd) -d”时,我得到:

/etc/ssh/sshd_config line 60: Deprecated option UsePrivilegeSeparation
debug1: sshd version OpenSSH_7.6, OpenSSL 1.0.2n  7 Dec 2017
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
Could not load host key: /etc/ssh/ssh_host_rsa_key
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
Missing privilege separation directory: /run/sshd

因此显然“UsePrivilegeSeparation”不再是一个有效的选项,但我仍然缺少特权分离目录。

如果我手动创建一个,它会开始工作,但当我实际尝试从不同的窗口连接时会失败:

debug1: sshd version OpenSSH_7.6, OpenSSL 1.0.2n  7 Dec 2017
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
Could not load host key: /etc/ssh/ssh_host_rsa_key
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8 
debug1: inetd sockets after dupping: 3, 3
Connection from 127.0.0.1 port 58061 on 127.0.0.1 port 22
debug1: Client protocol version 2.0; client software version OpenSSH_7.6p1 Ubuntu-4
debug1: match: OpenSSH_7.6p1 Ubuntu-4 pat OpenSSH* compat 0x04000000
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4
debug1: permanently_set_uid: 109/65534 [preauth]
debug1: ssh_sandbox_child: prctl(PR_SET_SECCOMP): Invalid argument [preauth]  
debug1: list_hostkey_types:  [preauth]
No supported key exchange algorithms [preauth]
debug1: do_cleanup [preauth]
debug1: monitor_read_log: child log fd closed
debug1: do_cleanup
debug1: Killing privsep child 136
debug1: audit_event: unhandled event 12

所以这是密钥交换方面的某种问题,但根据教程,我根本不需要担心这个问题,所以我知道我一定是犯了某种错误。我该怎么做才能解决这个连接问题?

答案1

我的问题最终得到了解决。我联系了 JetBrains,他们告诉我该教程已经过时,UsePrivilegeSeparation 已被弃用。然而,在最新的 PyCharm 早期版本之一之后(PyCharm 2018.3 EAP 7),他们添加了对连接到 Linux 子系统上的解释器的原生支持。

相关内容