我的服务器一直正常使用,平时使用secureCRT进行管理,使用secureFX进行文件的上传下载,突然有一天secureFX连接的时候出问题了,secureFX的日志如下:

i SecureFX 版本 6.6.1.289 (Official Release - November 4, 2010)
i 会话 00002 成功建立(为) session mydomain_218.245.0.54_cd.mydomain.com
i SSH2Core version 6.6.0.289
i 正在连接到 cd.mydomain.com:22 ...
i 正在从状态 STATE_NOT_CONNECTED 更改为 STATE_EXPECT_KEX_INIT
i Using protocol SSH2
i RECV : Remote Identifier = 'SSH-2.0-OpenSSH_5.3'
i CAP  : Remote can re-key
i CAP  : Remote sends language in password change requests
i CAP  : Remote sends algorithm name in PK_OK packets
i CAP  : Remote sends algorithm name in public key packets
i CAP  : Remote sends algorithm name in signatures
i CAP  : Remote sends error text in open failure packets
i CAP  : Remote sends name in service accept packets
i CAP  : Remote includes port number in x11 open packets
i CAP  : Remote uses 160 bit keys for SHA1 MAC
i CAP  : Remote supports new diffie-hellman group exchange messages
i CAP  : Remote correctly handles unknown SFTP extensions
i CAP  : Remote correctly encodes OID for gssapi
i CAP  : Remote correctly uses connected addresses in forwarded-tcpip requests
i The following key exchange method has been filtered from the key
exchange method list because it is not supported:
gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==
i SEND : KEXINIT
i RECV : Read kexinit
i Available Remote Kex Methods =
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

i Channel Closed.

很是不解,Google了半天也没解决问题。

首先为了确保其他稀奇古怪的问题出现,我将iptables和selinux都关闭,还是不行。
查看/etc/ssh/sshd_config文件中的 Subsystem       sftp    /usr/libexec/openssh/sftp-server  有没有被注释,经查是没有被注释的,而且文件系统里也有
[root@cd ~]# ll /usr/libexec/openssh/sftp-server
----------. 1 root root 63544 2月  22 2013 /usr/libexec/openssh/sftp-server
说明应该是对的。

然后开启了ssh的dubug模式,编辑/etc/ssh/sshd_config文件,将LogLevel INFO改为LogLevel DEBUG,重启了sshd服务
# /etc/init.d/sshd restart

再使用secureFX登录时查看日志信息,

查看# tail -f /var/log/messages 时没有日志输出,
查看# tail -f /var/log/secure 时日志输出如下,未见明显的错误信息输出:

Aug 12 18:21:59 cd sshd[1307]: debug1: Forked child 1870.
Aug 12 18:21:59 cd sshd[1870]: Set /proc/self/oom_score_adj to 0
Aug 12 18:21:59 cd sshd[1870]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Aug 12 18:21:59 cd sshd[1870]: debug1: inetd sockets after dupping: 3, 3
Aug 12 18:21:59 cd sshd[1870]: Connection from 171.214.177.214 port 52174
Aug 12 18:21:59 cd sshd[1870]: debug1: Client protocol version 2.0; client software version SecureFX_6_6_1_289 SecureFX
Aug 12 18:21:59 cd sshd[1870]: debug1: no match: SecureFX_6_6_1_289 SecureFX
Aug 12 18:21:59 cd sshd[1870]: debug1: Enabling compatibility mode for protocol 2.0
Aug 12 18:21:59 cd sshd[1870]: debug1: Local version string SSH-2.0-OpenSSH_5.3
Aug 12 18:21:59 cd sshd[1871]: debug1: permanently_set_uid: 74/74
Aug 12 18:21:59 cd sshd[1871]: debug1: list_hostkey_types: ssh-rsa,ssh-dss
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_KEXINIT sent
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_KEXINIT received
Aug 12 18:21:59 cd sshd[1871]: debug1: kex: client->server aes256-ctr hmac-sha1 none
Aug 12 18:21:59 cd sshd[1871]: debug1: kex: server->client aes256-ctr hmac-sha1 none
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
Aug 12 18:21:59 cd sshd[1871]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_NEWKEYS sent
Aug 12 18:21:59 cd sshd[1871]: debug1: expecting SSH2_MSG_NEWKEYS
Aug 12 18:21:59 cd sshd[1871]: debug1: SSH2_MSG_NEWKEYS received
Aug 12 18:21:59 cd sshd[1871]: debug1: KEX done
Aug 12 18:21:59 cd sshd[1871]: debug1: userauth-request for user root service ssh-connection method none
Aug 12 18:21:59 cd sshd[1871]: debug1: attempt 0 failures 0
Aug 12 18:21:59 cd sshd[1870]: debug1: PAM: initializing for "root"
Aug 12 18:21:59 cd sshd[1870]: debug1: PAM: setting PAM_RHOST to "171.214.177.214"
Aug 12 18:21:59 cd sshd[1870]: debug1: PAM: setting PAM_TTY to "ssh"
Aug 12 18:21:59 cd sshd[1871]: debug1: userauth-request for user root service ssh-connection

无解,继续Google解决办法 https://www.linuxquestions.org/questions/linux-server-73/can't-get-sftp-logging-to-work-931609/ 收到启发,将 /etc/ssh/sshd_config 中的

Subsystem      sftp    /usr/libexec/openssh/sftp-server
改为
Subsystem       sftp    internal-sftp

重启sshd后,sftp正常工作了。

但是原因仍然不知为何,回头看看,发现 /usr/libexec/openssh/sftp-server 没有任何权限:
# ll /usr/libexec/openssh/sftp-server
----------. 1 root root 63544 2月  22 2013 /usr/libexec/openssh/sftp-server

正常情况应该是这样:
# ll /usr/libexec/openssh/sftp-server
-rwxr-xr-x. 1 root root 63544 Nov 23  2013 /usr/libexec/openssh/sftp-server

咨询大师说 停止openssh 服务 rm sftp-server文件  正常的scp 过去 再启动openssh
但是我是远程操作,生产系统,不敢停止openssh服务,万一连不上就瓜了,大师建议那就先这样用着。

Note:/usr/libexec/openssh/sftp-server没任何权限,root用户都没法删除修改。

linux中ssh可以登录sftp不能登录解决办法的更多相关文章

  1. linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法

    linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法 http://blog.csdn.net/w616589292/article/details/38274475 dos2unix ...

  2. [转帖]Linux中buff/cache内存占用过高解决办法

    Linux中buff/cache内存占用过高解决办法 https://www.cnblogs.com/rocky-AGE-24/p/7629500.html /proc/sys/vm/drop_cac ...

  3. Linux中error while loading shared libraries错误解决办法

    默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,通常通过源码包进行安装时,如果不指定--prefix,会将库安装在/usr/local/lib目录下:当运行程序需要链接动态库 ...

  4. Linux中buff/cache内存占用过高解决办法

    在Linux系统中,我们经常用free命令来查看系统内存的使用状态.在一个centos7的系统上,free命令的显示内容大概是这样一个状态: 这个命令几乎是每一个使用过Linux的人必会的命令,但越是 ...

  5. linux中ssh登录Permanently added (RSA) to the list of known hosts问题解决

    文章出自http://www.2cto.com/os/201307/227199.html linux中ssh登录Permanently added (RSA) to the list of know ...

  6. linux下ssh端口的修改和登录

    linux下ssh端口的修改和登录 首先修改配置文件 vi /etc/ssh/sshd_config 找到#Port 22一段,这里是标识默认使用22端口,添加如下一行: Port 50000 然后保 ...

  7. (转)详解Linux中SSH远程访问控制

    详解Linux中SSH远程访问控制 原文:http://blog.51cto.com/dengqi/1260038 SSH:是一种安全通道协议,主要用来实现字符界面的远程登录,远程复制等功能(使用TC ...

  8. 关于Jmeter测试移动端应用时提示非法登录,不是合法的登录设备时的解决办法

    当Jmeter测试移动端应用时提示非法登录,不是合法的登录设备时的解决办法:只需要在jmeter的http信息头管理器中配置相应的设备信息,可通过抓包工具得到:即头信息Header中的Miscella ...

  9. [转载] Ubuntu 12.04下安装git,SSH及出现的Permission denied解决办法

    如何安装ssh http://os.51cto.com/art/201109/291634.htm 仅需要阅读至成功开启ssh服务即可 http://www.linuxidc.com/Linux/20 ...

  10. Xamarin中VS无法连接Mac系统的解决办法

    Xamarin中VS无法连接Mac系统的解决办法 按照以下步骤排查:(1)确认Mac系统中安装Xamarin.iOS开发必备的组件,如Mono.Xamarin.iOS.(2)将Windows和Mac下 ...

随机推荐

  1. Dell R710、720等系列类服务器 U盘安装centos6.5 操作系统

    一般全新服务器创建系统的时候,没做raid 会报错,如下: 解决: 开机启动时按F10,进入下面界面. 在LC设置-语言和键盘设置选项里可以选择界面显示的语言 在界面主页选项里选择"配置RA ...

  2. sublim text3 配置

    喜欢用sublime,但每次换环境都要重新百度下配置,太麻烦,故在此把自己喜欢的配置记录下来 sublime text2 可以直接在设置里改,但sublime text3不能直接在设置中改值,只能在s ...

  3. MYSQL基础--学习笔记

    最近一段时间,系统的学习了下mysql相关知识,当然都是比较基础的,现在贴出来,以供参考备忘--帅帅的小猪猪 创建用户:CREATE USER 'sampadm'@'localhost' IDENTI ...

  4. html + css (1)

    a{ text-decoration:none; /* 规定添加到文本的修饰;下划线没有了 */ margin:0px; font-size:15px; display: block; /* 以块级元 ...

  5. (转)mvc Area相关技术

    转自: http://www.cnblogs.com/zgqys1980/archive/2012/08/22/2650774.html ASP.NET MVC中,是依靠某些文件夹以及类的固定命名规则 ...

  6. 6.4 APK包限制

    Google 2015年 9月28日公告:为了Android开发商可以制作出更加复杂的app和游戏,Google Play游戏包体(APK)大小由原来的50MB提高到100MB.但是针对Android ...

  7. ActiveMQ学习笔记之异常

    1.PUT was not successful: 404 Not Found 结果:jetty.xml中开启BlobMessage相关配置 2.Consumer消费时:FileNotFoundExc ...

  8. 无线安全专题_破解篇02--kali破解pin码

    最近项目有点紧,所以本应该上周发的文章,拖到了本周三,在此说声抱歉.无线安全专题,我打算系统地写六个部分,分别为破解篇,攻击篇,欺骗篇,路由篇,移动篇和蓝牙篇,当然在发布的过程中,可能还会掺杂着发布f ...

  9. Dynamic CRM 2013学习笔记(三十九)流程2 - 业务流程(Business Process Flows)用法详解

    业务流程(Business Process Flows)是CRM 2013 里一个新的流程,它提供了可视化的流程表现.业务人员创建有效.流线型的业务流程让最终用户知道当前在哪.下一步要做什么,用户可以 ...

  10. spring mvc ajax返回值乱码

    加入如下配置: <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHan ...