Ubuntu中sftp配置问题

OS:Ubuntu 11.04 - the Natty Narwhal
ssh工作正常,但sftp总是有问题,详细信息如下:

H:\>sftp -v ubuntu@147.128.25.32
OpenSSH_6.0p1, OpenSSL 1.0.1b 26 Apr 2012
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 147.128.25.32 [147.128.25.32] port 22.
debug1: Connection established.
debug1: identity file /home/efanrui/.ssh/id_rsa type 1
debug1: identity file /home/efanrui/.ssh/id_rsa-cert type -1
debug1: identity file /home/efanrui/.ssh/id_dsa type -1
debug1: identity file /home/efanrui/.ssh/id_dsa-cert type -1
debug1: identity file /home/efanrui/.ssh/id_ecdsa type -1
debug1: identity file /home/efanrui/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debi
n-1ubuntu3
debug1: match: OpenSSH_5.8p1 Debian-1ubuntu3 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 5e:3d:73:f0:4e:94:0e:81:7b:eb:2d:5f:47:b4:a9:2b
debug1: Host '147.128.25.32' is known and matches the ECDSA host key.
debug1: Found key in /home/efanrui/.ssh/known_hosts:9
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-m
c,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/efanrui/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-m
c,password
debug1: Trying private key: /home/efanrui/.ssh/id_dsa
debug1: Trying private key: /home/efanrui/.ssh/id_ecdsa
debug1: Next authentication method: password
ubuntu@147.128.25.32's password:
debug1: Authentication succeeded (password).
Authenticated to 147.128.25.32 ([147.128.25.32]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2168, received 1552 bytes, in 1.5 seconds
Bytes per second: sent 1421.5, received 1017.6
[color=red]debug1: Exit status 127
Connection closed[/color]


/var/log/auth.log里log如下:
Aug 14 10:48:36 ubuntu-VirtualBox sshd[10097]: Accepted password for ubuntu from 127.0.0.1 port 54750 ssh2
Aug 14 10:48:36 ubuntu-VirtualBox sshd[10097]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)
Aug 14 10:48:38 ubuntu-VirtualBox sshd[10171]: subsystem request for sftp by user ubuntu
Aug 14 10:48:38 ubuntu-VirtualBox sshd[10171]: Received disconnect from 127.0.0.1: 11: disconnected by user
Aug 14 10:48:38 ubuntu-VirtualBox sshd[10097]: pam_unix(sshd:session): session closed for user ubuntu


Solution;参考http://forums.debian.net/viewtopic.php?f=5&t=42818

修改/etc/ssh/sshd_config:
from:
Subsystem sftp /usr/lib/openssh/sftp-serverto

to:
Subsystem sftp internal-sftp

然后重启ssh:service ssh restart

root@ubuntu-VirtualBox:/etc/ssh# ps -ef|grep sftp
ubuntu 10778 10777 0 11:04 ? 00:00:00 sshd: ubuntu@internal-sftp
ubuntu 10856 10854 0 11:04 ? 00:00:00 sshd: ubuntu@internal-sftp
root 10886 10417 0 11:06 pts/3 00:00:00 grep --color=auto sftp
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值