WinSCP says Cannot initialize SFTP protocol.
WinSCP says Cannot initialize SFTP protocol. Is the host running a SFTP server? when trying to connect via SFTP to my linux box. The sftp-server binary is located at /usr/lib/openssh/sftp-server. I don't like logging in as the root user when I don't need to. I would prefer to have WinSCP escalate me up to a root like shell on login so I added to my /etc/sudoers file and made sure requiretty was not under defaults. Then in winscp in the configuration for sftp server i typed Which didn't work, I also tried also didn't work. Here is a log.
blake ALL=NOPASSWD: /usr/lib/openssh/sftp-server
sudo /usr/lib/openssh/sftp-server
sudo su -c /usr/lib/openssh/sftp-server
. 2012-05-26 16:50:03.042 -------------------------------------------------------------------------- . 2012-05-26 16:50:03.043 WinSCP Version 5.0.5 (Build 1782) (OS 6.1.7601 Service Pack 1) . 2012-05-26 16:50:03.043 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\ . 2012-05-26 16:50:03.044 Local account: Blake-PC\Blake . 2012-05-26 16:50:03.044 Login time: Saturday, May 26, 2012 4:50:03 PM . 2012-05-26 16:50:03.044 -------------------------------------------------------------------------- . 2012-05-26 16:50:03.044 Session name: blake@98.215.151.160 (Modified stored session) . 2012-05-26 16:50:03.044 Host name: 98.215.151.160 (Port: 22) . 2012-05-26 16:50:03.044 User name: blake (Password: No, Key file: No) . 2012-05-26 16:50:03.044 Tunnel: No . 2012-05-26 16:50:03.044 Transfer Protocol: SFTP . 2012-05-26 16:50:03.044 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec . 2012-05-26 16:50:03.044 Proxy: none . 2012-05-26 16:50:03.044 SSH protocol version: 2; Compression: No . 2012-05-26 16:50:03.044 Bypass authentication: No . 2012-05-26 16:50:03.044 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No . 2012-05-26 16:50:03.044 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No . 2012-05-26 16:50:03.045 SSH Bugs: -,-,-,-,-,-,-,-,- . 2012-05-26 16:50:03.045 SFTP Bugs: -,- . 2012-05-26 16:50:03.045 Return code variable: Autodetect; Lookup user groups: Yes . 2012-05-26 16:50:03.045 Shell: default . 2012-05-26 16:50:03.045 EOL: 0, UTF: 2 . 2012-05-26 16:50:03.045 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes . 2012-05-26 16:50:03.045 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No . 2012-05-26 16:50:03.045 Local directory: default, Remote directory: home, Update: No, Cache: Yes . 2012-05-26 16:50:03.045 Cache directory changes: Yes, Permanent: Yes . 2012-05-26 16:50:03.045 DST mode: 1 . 2012-05-26 16:50:03.045 -------------------------------------------------------------------------- . 2012-05-26 16:50:03.153 Looking up host "*SNIP*" . 2012-05-26 16:50:03.154 Connecting to "*SNIP*" port 22 . 2012-05-26 16:50:03.210 Server version: SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1 . 2012-05-26 16:50:03.211 We believe remote version has SSH-2 ignore bug . 2012-05-26 16:50:03.211 Using SSH protocol version 2 . 2012-05-26 16:50:03.211 We claim version: SSH-2.0-WinSCP_release_5.0.5 . 2012-05-26 16:50:03.215 Doing Diffie-Hellman group exchange . 2012-05-26 16:50:03.267 Doing Diffie-Hellman key exchange with hash SHA-1 . 2012-05-26 16:50:03.562 Host key fingerprint is: . 2012-05-26 16:50:03.562 ssh-rsa 2048 02:e6:f6:98:69:96:70:85:2a:b2:01:51:06:14:cb:10 . 2012-05-26 16:50:03.562 Initialised AES-256 SDCTR client->server encryption . 2012-05-26 16:50:03.562 Initialised HMAC-SHA1 client->server MAC algorithm . 2012-05-26 16:50:03.562 Initialised AES-256 SDCTR server->client encryption . 2012-05-26 16:50:03.562 Initialised HMAC-SHA1 server->client MAC algorithm . 2012-05-26 16:50:03.612 Pageant is running. Requesting keys. . 2012-05-26 16:50:03.613 Pageant has 1 SSH-2 keys ! 2012-05-26 16:50:03.613 Using username "blake". . 2012-05-26 16:50:08.717 Trying Pageant key #0 ! 2012-05-26 16:50:08.722 Authenticating with public key "rsa-key-20120309" from agent . 2012-05-26 16:50:08.808 Sending Pageant's response . 2012-05-26 16:50:08.813 Access granted . 2012-05-26 16:50:09.206 Opened channel for session . 2012-05-26 16:50:09.214 Started a shell/command . 2012-05-26 16:50:09.234 -------------------------------------------------------------------------- . 2012-05-26 16:50:09.234 Using SFTP protocol. . 2012-05-26 16:50:09.235 Doing startup conversation with host. > 2012-05-26 16:50:09.288 Type: SSH_FXP_INIT, Size: 5, Number: -1 ! 2012-05-26 16:50:09.288 sudo: no tty present and no askpass program specified . 2012-05-26 16:50:09.288 Server sent command exit status 1 . 2012-05-26 16:50:09.288 Disconnected: All channels closed * 2012-05-26 16:50:09.346 (EFatal) Connection has been unexpectedly closed. Server sent command exit status 1. * 2012-05-26 16:50:09.346 Cannot initialize SFTP protocol. Is the host running a SFTP server?