【发布时间】:2020-09-10 16:32:59
【问题描述】:
所以我最近在使用旧的工作笔记本电脑时遇到了问题,需要访问资产和公司实例以进行管理。我安装了 OpenSSH 并且通常可以在 Powershell 中使用它,但是由于某些奇怪的原因,我的配置,密钥不起作用。为什么我无法加载我的密钥并获得访问权限,但是如果我使用 Pageant 将其转换为 PK 文件,它会起作用。
密钥最初是在 Macbook 上制作的,然后我将其转移到我的 windows 主机上。 OpenSSH 可以在 Windows 上运行,但不会提供正确的密钥。
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:
debug3: hostkeys_foreach: reading file "/dev/null"
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
Warning: Permanently added 'XXX.XX.XX.XX' (ECDSA) to the list of known hosts.
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: C:\\Users\\richard.barrett/\\.ssh\\Mirantis\\id_rsa (00000145F1EB10A0), explicit, agent
debug2: key: C:\\Users\\richard.barrett/.ssh/Mirantis/id_rsa (00000145F1EB1650)
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 53
debug3: input_userauth_banner
=================================== WARNING ====================================
You have accessed a computer managed by Mirantis INC.
You are required to have authorization from Mirantis INC
before you proceed and you are strictly limited to use set out within that
authorization. Unauthorized access to or misuse of this system is prohibited
and constitutes an offence under the Computer Misuse Act 1990.
If you disclose any information obtained through this system without authority
================================================================================
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:
C:\\Users\\richard.barrett/\\.ssh\\Mirantis\\id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Offering public key: RSA SHA256:
C:\\Users\\richard.barrett/.ssh/Mirantis/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
delvalle_tc\\richard.barrett@XXX.XX.XX.XXX\: Permission denied (publickey).
但是当我使用 putty gen 转换它时它会起作用吗? 我有两个 openssh 键
~\.ssh\id_rsa
~\.ssh\Mirantis\id_rsa
如何在两个键之间切换?
此外,如何在我的新 Windows 主机上使用我的 macbook 中的旧配置?
OpenSSH 一直使用不同的配置文件,考虑到我从未尝试在两个不同的操作系统主机之间传输密钥,我设法在旧 macbook 冻结之前复制了旧密钥,我很好奇这是否正常,因为我已经有一个我的 ~.ssh 文件夹中的不同密钥我创建了一个 ~\.ssh\Mirantis\ 文件夹,但是尽管我更改了 C:\ProgramData\ssh 中的 ssh_config,它仍然提供主密钥
我尝试按照此处的说明进行操作,但对于如何在 Windows 中将ssh_config 设置为导入的config,并没有提供任何建议:https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration
【问题讨论】: