密码输入后 SFTP 连接关闭

密码输入后 SFTP 连接关闭

我们已经在 Windows 2012 上设置了 Cygwin,并且与该工具相关的服务在服务器上运行良好。

在安装过程中,我们创建了一个本地用户 cyg_server,我们尝试使用 cyg_server 创建主文件夹,sftp cyg_server@servername但在这种情况下,当我们尝试执行此操作时sftp -v cyg_server@servername,它会提示我们输入密码,并且建立的连接会立即关闭,结果如下。

细节

ssh -v [email protected]
OpenSSH_4.2p1, OpenSSL 0.9.7i 14 Oct 2005
debug1: Reading configuration data /opt/LTIssh/etc/ssh_config
debug1: Connecting to fn002dataaege-n.fn.ae.ge.com [3.14.136.107] port 22.
debug1: Connection established.
debug1: identity file /export/home/chettigo/.ssh/identity type -1
debug1: identity file /export/home/chettigo/.ssh/id_rsa type 1
debug1: identity file /export/home/chettigo/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'fn002dataaege-n.fn.ae.ge.com' is known and matches the RSA host key.
debug1: Found key in /export/home/chettigo/.ssh/known_hosts:2035
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /export/home/chettigo/.ssh/identity
debug1: Offering public key: /export/home/chettigo/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /export/home/chettigo/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
[email protected]'s password: 
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
Last login: Thu Feb 26 06:23:07 2015 from gpsgc304.corporate.ge.com
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to fn002dataaege-n.fn.ae.ge.com closed.
debug1: Transferred: stdin 0, stdout 0, stderr 52 bytes in 17.6 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 3.0
debug1: Exit status 1

我该如何调试并解决这个问题?

答案1

在您的帐户 shell 初始化脚本中,我发现如果有任何输出被发送到 stdout 然后scp/sftp按照您描述的方式失败。

您要做的是检查远程主机上的所有文件,包括:

  • 帐户特定.cshrc,,,,.login.bashrc.env.profile
  • 全局初始化文件,/etc例如bashrc,,csh.cshrccsh.login

相关内容