Linux机器使用“ssh”登录Windows机器?


1

我在一家公司。

linux机器的IP是192.168.8.183,

我的Windows机器的IP是172.16.22.53。

linux机器和Windows mashine是真正的机器,而不是VM虚拟机。

首先我安装了cygwin。

然后我为我的Windows机器安装了copssh和openssh-server。但是在尝试了很多之后,我卸载了copssh和openssh-server。

现在只有cygwin存在!

之后重启我的Windows机器。然后我使用putty im my windows machine登录linux机器,然后使用$ ssh sikaiwei@172.16.22.53,但出现了一些错误:

[sikaiwei@login-0-11 ~]$ ssh sikaiwei@172.16.22.53
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
61:aa:6a:0d:85:da:bc:82:64:42:b6:56:3f:27:02:2b.
Please contact your system administrator.
Add correct host key in /home/sikaiwei/.ssh/known_hosts to get rid of this message.
Offending key in /home/sikaiwei/.ssh/known_hosts:2
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
Agent forwarding is disabled to avoid man-in-the-middle attacks.
X11 forwarding is disabled to avoid man-in-the-middle attacks.
Permission denied (publickey,password,keyboard-interactive).
[sikaiwei@login-0-11 ~]$

我发现这个:

Add correct host key in /home/sikaiwei/.ssh/known_hosts to get rid of this message.

所以我去/home/sikaiwei/.ssh/known_hosts:

[sikaiwei@login-0-11 .ssh]$ vi known_hosts
192.168.8.183 ssh-rsa   AAAAB3NzaC1yc2EAAAABIwAAAQEAr0OPxQ49Nvl9JxvUEKsFa0LraupPW
i3zShoBCiSNSgaiQZNA/7v6YCYovVV+Fyd1+AoIuAVN+17jiuiLc9Upxkqu3     
/BQnEZB1quDUFPLnNYXguentNmGDLeovrrzHCY8nfUNstxNOm 
/fGosu1kwmQT7MyWB2j2dhjgkf8k0NOsrZkBOoz4zwoLhvAs 
/N8zhiI+DKiJ3b6SSxPfr582FM2uEnsXB6jql4B2AONICxmPfU1nBhsSx0IaX+esOGDD9
Rfk03QPqPAgmDapqGbz6EhnUY3cIXt5JEpznkogM6gZoTNLB+fX878YHqRRkqzBUD
 4xhp5dlAQ+h5nCscK5GcFw==
 172.16.22.53 ssh-rsa     
AAAAB3NzaC1yc2EAAAADAQABAAAAgQDQxnLSG/xVy6jSMd2cyv+5G2pR8MrKOnlqJv+ppfl5Nb1CfKgrK8c
Q2BnlFuSJTnVWsBtc89812tGmLsaE2NaFVxDStAW0JoqO5W9IShT0hCRvcn9sAu3yS
ZQYYXZgJIG0dSR2YBUyNv+tqRQWSbWswGUKjVqOlRPQ/M6DTsLFCw==

我删除了第2行,但随后:

[sikaiwei@login-0-11 .ssh]$ ssh sikaiwei@172.16.22.53
Warning: Permanently added '172.16.22.53' (RSA) to the list of known hosts.
sikaiwei@172.16.22.53's password:
Permission denied, please try again.
 sikaiwei@172.16.22.53's password:
 Permission denied, please try again.
 sikaiwei@172.16.22.53's password:
 Permission denied (publickey,password,keyboard-interactive).

Answers:


2

您应该了解此错误的底部并进行修复。

该错误基本上意味着SSH客户端识别您尝试连接的IP地址/主机名,但与该框关联的密钥已更改。如果您使用的DHCP可以解释问题。

如果您确信自己正在使用正确的机器,则可以编辑/home/sikaiwei/.ssh/known_hosts并删除第2行。

如果你想总是摆脱这个消息 - 对于所有主机 - 并且可以防止中间人攻击的风险,你可以删除/home/sikaiwei/.ssh/known_hosts然后将其符号链接到/ dev / null使用命令“ln -s / etc / null /home/sikaiwei/.ssh/known_hosts”。这是不可取的。

您还可以使用命令“ssh -o UserKnownHostsFile = / dev / null username @ address”暂时忽略此文件


我应该删除/home/sikaiwei/.ssh/known_hosts中的第2行吗?
橙色

是。这将解决问题,直到IP地址更改。问题是为什么会发生错误。如果您已重建机器或更改了其IP地址,则可以执行此操作。
davidgo

没关系!但是出现了新的错误(我重复了我的问题)
橙色

好的,这意味着您无法登录,因为服务器和客户端无法就身份验证达成一致。您打算如何登录?使用密码或公钥/私钥?您确定您的密码是否正确并且服务器上存在“sikaiwei”帐户 - 使用该密码?
davidgo

我想使用密码登录。我在登录Windows机器时使用“sikaiwei”和密码。
橙色
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.