我在 Debian 上使用 openssh-server 在端口 10022 上运行 sftp 服务器,托管在 EC2/AWS 上。我为单个用户配置了基于密码的身份验证,但在我提交正确的密码后,服务器连接立即关闭。以下是 sftp 客户端的输出:
steve@localhost's password:
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to localhost ([127.0.0.1]:10022).
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Connection to localhost closed by remote host.
Transferred: sent 1972, received 1644 bytes, in 0.0 seconds
Bytes per second: sent 1281358.2, received 1068231.7
debug1: Exit status -1
Couldn't read packet: Connection reset by peer
我的服务器在 Docker 容器内运行,真正奇怪的是,如果我在 Mac 上本地运行 Docker 容器,我可以正常连接,但当我在 AWS 服务器上运行它时,我遇到了上述问题。上述输出是通过在 AWS 服务器上运行 sftp 客户端(尝试连接到本地主机)生成的,因此我认为这与 AWS 的网络访问无关
答案1
我会设置LogLevel VERBOSE
然后/etc/ssh/sshd_config
重新启动 sshd 并检查/var/log/auth.log
以获取更多详细信息。