Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was unable to connect to the server through winscp (after changing permissions of www directory of Apache server accidently), it shows Cannot initialize SFTP protocol. Is the host running a SFTP server? when executing this command in terminal sftp -P port-vv username@serverip ,I am getting the following response, what might be the problem?

debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to ***** 
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: fd 3 setting TCP_NODELAY
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
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
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 1952, received 1960 bytes, in 0.3 seconds
Bytes per second: sent 6473.8, received 6500.3
debug1: Exit status 141
share|improve this question
    
Can you post relevant log extracts from the server? –  Flup May 7 '13 at 7:35
add comment

1 Answer

OpenSSH runs a program called sftp-server when a client requests SFTP. In your case, the client requested SFTP, the server said "okay", then the SFTP channel closed:

debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
[snip]
debug2: subsystem request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0

The simplest explanation is that the sftp-server program is missing from the server or can't be executed for some reason. You can't tell exactly what is wrong from the client. You'll have to troubleshoot this on the server.

On my system, the program is /usr/libexec/openssh/sftp-server, but it may be somewhere else for you.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.