Ubuntu中sftp配置问题

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

H:\>sftp -v [email protected]
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
[email protected]'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 [email protected]
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 [email protected] 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
debug1: Exit status 127
Connection closed



/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

猜你喜欢

转载自fanrey.iteye.com/blog/1631190