o**n 发帖数: 1249 | 1 今天ssh一个我以前经常用的server出现以下error
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
xx:xx...........xx
Please contact your system administrator.
Add correct host key in /home/xxx/.ssh/known_hosts to get rid of this
message.
Offending key in /home/xxx/.ssh/known_hosts:2
RSA host key for xxx.xxx.xxx has changed and you have requested strict
checking.
Host key verification failed.
请问这是什么意思呢?应该怎么做呢?
其中的xxx是我划掉的个人信息。
谢谢! |
w****g 发帖数: 206 | 2 清空known_hosts
【在 o**n 的大作中提到】 : 今天ssh一个我以前经常用的server出现以下error : 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 : xx:xx...........xx : Please contact your system administrator. : Add correct host key in /home/xxx/.ssh/known_hosts to get rid of this : message. : Offending key in /home/xxx/.ssh/known_hosts:2
|
o**n 发帖数: 1249 | 3 3x!
【在 w****g 的大作中提到】 : 清空known_hosts
|
o**n 发帖数: 1249 | 4 又有一个问题,我可应用ssh连上了,但用gftp或filezilla的时候出错,gftp的出错提
示是:Could not read from socket: Connection reset by peer。filezilla的提示
是:connection closed by server with exitcode 127。
我在google这个错误,如果大家知道,麻烦提示一下,谢谢!
【在 w****g 的大作中提到】 : 清空known_hosts
|
r*****z 发帖数: 906 | 5 ssh和ftp server是两码事啊
【在 o**n 的大作中提到】 : 又有一个问题,我可应用ssh连上了,但用gftp或filezilla的时候出错,gftp的出错提 : 示是:Could not read from socket: Connection reset by peer。filezilla的提示 : 是:connection closed by server with exitcode 127。 : 我在google这个错误,如果大家知道,麻烦提示一下,谢谢!
|
z**r 发帖数: 17771 | 6 你的客户端是linux吗?如果是的话,客户端用sftp -v xxx@server,然后server端停
掉sshd,用sshd -d打开debug mode,这样,两边的debug info都可以看到,然后贴过
来大家分析一下
【在 o**n 的大作中提到】 : 又有一个问题,我可应用ssh连上了,但用gftp或filezilla的时候出错,gftp的出错提 : 示是:Could not read from socket: Connection reset by peer。filezilla的提示 : 是:connection closed by server with exitcode 127。 : 我在google这个错误,如果大家知道,麻烦提示一下,谢谢!
|
o**n 发帖数: 1249 | 7 可是用ssh的protocol阿,像filezilla之类的不都是让选择是ftp,ftps,ssh2等之类的
protocol么,这个和用ssh command不一样么?我不太懂。但我以前是一直可以用gftp
,filezilla之类的连这个server的,就是最近突然不行了。
【在 r*****z 的大作中提到】 : ssh和ftp server是两码事啊
|
o**n 发帖数: 1249 | 8 客户端是linux。
我按照你说的用sftp连,信息过后提示让我输入密码,我输入后显示如下
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp
subsystem request failed on channel 0
Couldn't read packet: Connection reset by peer
然后就回shell了。需要我把sftp命令之后的output列出来么?是关于rsa key之类的东
西,我不太
懂。
我确定密码是对的,我仍然可以ssh连进去。别人用windows版的filezilla也连不进去
,以前是能连进去的。
谢谢帮忙!
【在 z**r 的大作中提到】 : 你的客户端是linux吗?如果是的话,客户端用sftp -v xxx@server,然后server端停 : 掉sshd,用sshd -d打开debug mode,这样,两边的debug info都可以看到,然后贴过 : 来大家分析一下
|
z**r 发帖数: 17771 | 9 sftp是ssh的一个subsystem,用的是一样的协议。
gftp
【在 o**n 的大作中提到】 : 可是用ssh的protocol阿,像filezilla之类的不都是让选择是ftp,ftps,ssh2等之类的 : protocol么,这个和用ssh command不一样么?我不太懂。但我以前是一直可以用gftp : ,filezilla之类的连这个server的,就是最近突然不行了。
|
z**r 发帖数: 17771 | 10 server端的debug呢?你没有root?你能看/etc/ssh/sshd_config吗?把这个贴出来也
许有帮助
【在 o**n 的大作中提到】 : 客户端是linux。 : 我按照你说的用sftp连,信息过后提示让我输入密码,我输入后显示如下 : debug1: Authentication succeeded (password). : debug1: channel 0: new [client-session] : debug1: Entering interactive session. : debug1: Sending environment. : debug1: Sending env LANG = en_US.UTF-8 : debug1: Sending subsystem: sftp : subsystem request failed on channel 0 : Couldn't read packet: Connection reset by peer
|
|
|
o**n 发帖数: 1249 | 11 /etc/ssh/sshd_config内容:
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for
RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for
RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# SOMe PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
#AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
#UsePAM yes
#IdentityFile %h/.ssh/id_rsa
【在 z**r 的大作中提到】 : server端的debug呢?你没有root?你能看/etc/ssh/sshd_config吗?把这个贴出来也 : 许有帮助
|
o**n 发帖数: 1249 | 12 哦,是这样阿。
刚才贴的那个/etc/ssh/sshd_config里提到sftp
Subsystem sftp /usr/lib/openssh/sftp-server
【在 z**r 的大作中提到】 : sftp是ssh的一个subsystem,用的是一样的协议。 : : gftp
|
S*A 发帖数: 7142 | 13 改这个:
LogLevel DEBUG3
然后重启 sshd,sftp 登录,
在 system log file 里面应该有很多 sshd 的 entry.
那里应该有很多提示 sshd 为什么自动退出了。
to
【在 o**n 的大作中提到】 : /etc/ssh/sshd_config内容: : # Package generated configuration file : # See the sshd(8) manpage for details : # What ports, IPs and protocols we listen for : Port 22 : # Use these options to restrict which interfaces/protocols sshd will bind to : #ListenAddress :: : #ListenAddress 0.0.0.0 : Protocol 2 : # HostKeys for protocol version 2
|
z**r 发帖数: 17771 | 14 开始怀疑你的server把sftp subsystem 关掉了,但是config里还在,现在十分怀疑的
sftp subsystem 有问题,你/etc/init.d/sshd restart一下,或者/etc/init.d/ssh
restart
【在 o**n 的大作中提到】 : 哦,是这样阿。 : 刚才贴的那个/etc/ssh/sshd_config里提到sftp : Subsystem sftp /usr/lib/openssh/sftp-server
|
z**r 发帖数: 17771 | 15 他可能没有root权限,俺一开始就要了sshd -d,他没提供,俺估计是没有权限
【在 S*A 的大作中提到】 : 改这个: : LogLevel DEBUG3 : 然后重启 sshd,sftp 登录, : 在 system log file 里面应该有很多 sshd 的 entry. : 那里应该有很多提示 sshd 为什么自动退出了。 : : to
|
o**n 发帖数: 1249 | 16 拿到root权限了。问题解决了,很愚蠢的问题,sshd_config中sftp-sever的路径错了
,多亏zher告诉我sftp和ssh的关系并让我找sshd_config。
这个是我以前学校group的网站server,一直都是学生管(以前是我管),但其实我们
都不太懂这些东西。加上系统好像是Unix还是BSD的一个变种?很多东西都不在我熟悉
的地方,用起来很不方便,连个vim都没有,只有vi:)
按理说不应该有人改这个config,或者是sftp-server update时候换位置了,挺奇怪。
谢谢帮忙,我包子不多,别嫌少:)
【在 z**r 的大作中提到】 : 他可能没有root权限,俺一开始就要了sshd -d,他没提供,俺估计是没有权限
|
z**r 发帖数: 17771 | 17 太客气了,还有包子,呵呵
【在 o**n 的大作中提到】 : 拿到root权限了。问题解决了,很愚蠢的问题,sshd_config中sftp-sever的路径错了 : ,多亏zher告诉我sftp和ssh的关系并让我找sshd_config。 : 这个是我以前学校group的网站server,一直都是学生管(以前是我管),但其实我们 : 都不太懂这些东西。加上系统好像是Unix还是BSD的一个变种?很多东西都不在我熟悉 : 的地方,用起来很不方便,连个vim都没有,只有vi:) : 按理说不应该有人改这个config,或者是sftp-server update时候换位置了,挺奇怪。 : 谢谢帮忙,我包子不多,别嫌少:)
|
x**m 发帖数: 941 | 18 插个嘴,虽然学校的机器安全什么的大家一般都不在乎,但是不管现在谁在管,应该问
问为什么host fingerprint变了。ssh和sftp的配置都不会造成这个变化,要么是重装
了,要么是被人改了。 |
o**n 发帖数: 1249 | 19 fingerprint是不是sshd restart一次就会变?因为我今天在鼓闹这个东西的时候曾
restart sshd好几次,每次之后都要把自己的./ssh/known_hosts清空才能再ssh过去。
【在 x**m 的大作中提到】 : 插个嘴,虽然学校的机器安全什么的大家一般都不在乎,但是不管现在谁在管,应该问 : 问为什么host fingerprint变了。ssh和sftp的配置都不会造成这个变化,要么是重装 : 了,要么是被人改了。
|
x**m 发帖数: 941 | 20 host fingerprint文件在/etc/ssh/sshd_config有定义。重启服务器或者服务应该是不
会变的。 |
S*A 发帖数: 7142 | 21 有可能 /etc/ssh/ 不能被 sshd 写。
sshd 如果发现没有 host key 的话会自动生成一个。
如果没有办法存下来就会每次启动都是新的。 |
x**m 发帖数: 941 | 22 没有去查,但是想来SSHd是以root运行的吧。加上这个是普通服务器不是嵌入式系统,
不能正常写入的可能要小些。我感觉有点什么问题,说不定那个学生在上面胡玩呢。 |