【发布时间】:2016-10-14 21:49:14
【问题描述】:
我遇到了一个问题,我有一个 SFTP 服务器(没有 SSH shell 访问权限)。
当我从客户端机器发出 SFTP 请求时,它可以工作:
sftp username@remote_IP
然后,如果我发出 SSH 请求,它就会挂起
ssh -l username -s remote_IP sftp
但ssh 手册页表明
-s May be used to request invocation of a subsystem on the remote
system. Subsystems facilitate the use of SSH as a secure
transport for other applications (e.g. sftp(1)). The subsystem
is specified as the remote command.
远程服务器上的 SSH 服务器是否必须启用此功能,还是有其他方法可以解决此问题?
添加详细日志....首先让我与您分享sftp详细模式日志,其中建议:
debug1: Authentication succeeded (publickey)
debug1: fd 5 setting O_NONBLOCK
debug2: fd 6 is O_NONBLOCK
debug2: TCP receive buffer size: 49640 B
debug1: SSH receive window size: 198560 B
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug1: send channel open 0
debug1: Entering interactive session.
debug2: callback start
debug1: ssh_session2_setup: id 0
debug1: Sending subsystem: sftp
debug1: channel request 0: subsystem
debug2: callback done
debug1: channel 0: open confirm rwindow 2097152 rmax 32768
debug2: Remote version: 3
debug3: Sent message fd 5 T:16 I:1
debug3: SSH_FXP_REALPATH . -> /root
sftp> pwd
现在我正在显示ssh -l username -s remote_IP sftp 的详细输出
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug2: fd 4 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
这就是它挂起的地方。
简而言之,问题是“如果 SFTP 工作并在服务器上启用,ssh 会发生什么情况,它正在远程服务器上调用子系统 sftp”?在服务器端或事实上在客户端需要什么才能使其工作?
如果我理解有问题,请澄清我的基本理解。
【问题讨论】: