ssh可以登录sftp不能登录。
我的VPS一直正常使用,平时使用 `Xshell` 进行管理,使用 `Xftp` 进行文件的上传下载,突然有一天 `Xftp` 连不上了。
很是不解,Google了半天也没解决问题。
查看 `/etc/ssh/sshd_config` 文件中的
```
Subsystem sftp /usr/libexec/openssh/sftp-server
```
有没有被注释,经查是没有被注释的,而且文件系统里也有
```
[root@sherlocky VPS]# ll -al /usr/libexec/openssh/sftp-server
-rwxr-xr-x 1 root root 67640 5月 12 12:52 /usr/libexec/openssh/sftp-server
```
说明应该是对的。
然后开启了 `ssh` 的 `dubug` 模式,编辑 `/etc/ssh/sshd_config` 文件,将 `LogLevel INFO` 改为 `LogLevel DEBUG`,重启了 `sshd` 服务
```
/etc/init.d/sshd restart
```
查看日志信息,
```
tail -f /var/log/messages
```
时没有日志输出,
```
tail -f /var/log/secure
```
也未见明显的错误信息输出。
无解,继续Google解决办法 [https://www.linuxquestions.org/questions/linux-server-73/can't-get-sftp-logging-to-work-931609/](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` 正常工作了。
原因还不明。。。
linux服务器无法连接sftp