title: FileZilla, 'sftp' command on Linux won't connect to specific server. SSH works, and on Windows everything works correctly
body: <p>I've got a specific server (let's call it <code>some.server.com</code>) for which I'm <strong>not</strong> the administrator, but I've got an user account for which SSH is enabled (it works on both Windows with PuTTY, and Linux with the default <code>ssh</code> command), and I want to access it using the SFTP protocol.</p>
  <p>On Windows, everything works using FileZilla. I configured the user@some.server.com and enter the password when asked. I <em>did</em> have to change &quot;Advanced -&gt; Default Remote Directory&quot; to <code>/</code> (or the full path to my home directory) for it to work, however. If I don't do it, it exits with after the lines:</p>
  <pre><code>Command:   pwd
  Response:  Current directory is: &quot;.&quot;
  Error:     Failed to parse returned path.
  Error:     Failed to retrieve directory listing.
  </code></pre>
  <p>I assume this is due to some weird misconfiguration in the server.</p>
  <p>On Linux (Linux Mint 17.2), however, nothing works. FileZilla hangs on <code>open &quot;user@some.server.com&quot; 22</code>, and then times out. If I turn on debug output, the following happens:</p>
  <pre><code>Command:    open &quot;user@some.server.com&quot; 22
  Trace:  Server version: SSH-2.0-OpenSSH_6.9p1-hpn14v5
  Trace:  Using SSH protocol version 2
  Trace:  We claim version: SSH-2.0-PuTTY_Local:_Sep_14_2013_01:12:43
  Trace:  Doing Diffie-Hellman group exchange
  ** About 30 seconds go by **
  Error:  Connection timed out
  Trace:  CControlSocket::DoClose(2050)
  Trace:  CSftpControlSocket::ResetOperation(2114)
  Trace:  CControlSocket::ResetOperation(2114)
  Error:  Could not connect to server
  </code></pre>
  <p>I thought it might be a problem with the FileZilla installation, but it works for all other servers I've tried it with (including my personal server). I double-checked, and Windows does a ECDH key exchange when connecting to the same server, instead of a DH one like in this trace. Maybe that's the problem?</p>
  <p>I also tried to use the <code>sftp</code> command. It connects and asks me for my password. I enter it, and then it exits with this error:</p>
  <pre><code>sftp user@some.server.com
  Password: ** I enter my password **
  Connected to some.server.com.
  Couldn't canonicalize: No such file or directory
  Need cwd
  </code></pre>
  <p>I thought this was the same error that FileZilla had on Windows, so I tried the command <code>sftp user@some.server.com:/</code>, but I was presented with the same error.</p>
  <p>I've talked with the administrators per e-mail, and I'm the first person to report such a problem. They think it might be some problem with my configuration, and want me to come to their offices in person to help figure out the problem. Thing is, this is a desktop, and I currently have no laptop with Linux installed on which I can test this. I was actually thinking of installing VirtualBox on my Windows laptop to double-check, but I haven't been able to find the time.</p>
  <p>Any ideas? Thanks.</p>
  <h1>Edit 1: WinSCP logs</h1>
  <pre><code>. 2015-11-16 19:40:25.018 Session name: user@some.server.com (Ad-Hoc site)
  . 2015-11-16 19:40:25.018 Host name: some.server.com (Port: 22)
  . 2015-11-16 19:40:25.019 User name: user (Password: Yes, Key file: No)
  . 2015-11-16 19:40:25.019 Tunnel: No
  . 2015-11-16 19:40:25.019 Transfer Protocol: SFTP (SCP)
  . 2015-11-16 19:40:25.019 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
  . 2015-11-16 19:40:25.019 Disable Nagle: No
  . 2015-11-16 19:40:25.019 Proxy: none
  . 2015-11-16 19:40:25.019 Send buffer: 262144
  . 2015-11-16 19:40:25.019 SSH protocol version: 2; Compression: No
  . 2015-11-16 19:40:25.019 Bypass authentication: No
  . 2015-11-16 19:40:25.019 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
  . 2015-11-16 19:40:25.019 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
  . 2015-11-16 19:40:25.019 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
  . 2015-11-16 19:40:25.019 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
  . 2015-11-16 19:40:25.019 Simple channel: Yes
  . 2015-11-16 19:40:25.019 Return code variable: Autodetect; Lookup user groups: A
  . 2015-11-16 19:40:25.019 Shell: default
  . 2015-11-16 19:40:25.019 EOL: 0, UTF: 2
  . 2015-11-16 19:40:25.019 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
  . 2015-11-16 19:40:25.019 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
  . 2015-11-16 19:40:25.019 SFTP Bugs: A,A
  . 2015-11-16 19:40:25.019 SFTP Server: default
  . 2015-11-16 19:40:25.019 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
  . 2015-11-16 19:40:25.019 Cache directory changes: Yes, Permanent: Yes
  . 2015-11-16 19:40:25.019 DST mode: 1
  . 2015-11-16 19:40:25.019 --------------------------------------------------------------------------
  . 2015-11-16 19:40:25.095 Looking up host &quot;some.server.com&quot;
  . 2015-11-16 19:40:25.099 Connecting to X.X.X.X port 22
  . 2015-11-16 19:40:27.305 Selecting events 63 for socket 1172
  . 2015-11-16 19:40:27.307 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.307 Looking for incoming data
  . 2015-11-16 19:40:27.307 Looking for network events
  . 2015-11-16 19:40:27.307 Detected network event
  . 2015-11-16 19:40:27.307 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.307 Enumerated 18 network events making 18 cumulative events for socket 1172
  . 2015-11-16 19:40:27.307 Handling network write event on socket 1172 with error 0
  . 2015-11-16 19:40:27.307 Handling network connect event on socket 1172 with error 0
  . 2015-11-16 19:40:27.307 Looking for network events
  . 2015-11-16 19:40:27.331 Detected network event
  . 2015-11-16 19:40:27.331 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.331 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:27.331 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:27.331 Server version: SSH-2.0-OpenSSH_6.9p1-hpn14v5
  . 2015-11-16 19:40:27.331 Using SSH protocol version 2
  . 2015-11-16 19:40:27.331 We claim version: SSH-2.0-WinSCP_release_5.7.6
  . 2015-11-16 19:40:27.331 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.332 Looking for incoming data
  . 2015-11-16 19:40:27.332 Looking for network events
  . 2015-11-16 19:40:27.348 Detected network event
  . 2015-11-16 19:40:27.348 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.348 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:27.348 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:27.348 Using Diffie-Hellman with standard group &quot;group14&quot;
  . 2015-11-16 19:40:27.348 Doing Diffie-Hellman key exchange with hash SHA-1
  . 2015-11-16 19:40:27.395 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.395 Looking for incoming data
  . 2015-11-16 19:40:27.395 Looking for network events
  . 2015-11-16 19:40:27.424 Detected network event
  . 2015-11-16 19:40:27.425 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.425 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:27.425 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:27.491 Verifying host key rsa2 0x10001,0xa3b26aa134c3f969 4052dfe9a1ec42d7 310b92bcac0703ad c318ecf305d516a4 8b56cbd1d737d058 2c8de0d374ae84ed e59afe086462b068 47935368373deeca 5db04cceefbfb6e8 0b4176041e1ffc74 a729a23421d6ad97 45e9101fab34399f 103e3f3567612029 d672a215feda64fd 93de6a5cfb59d69e 0e383e6e0e332f58 a835944076e5b952 947521b8d6b7cc92 9c9758b73211928b a6eade34dfc79617 b8ae9a4743abfad0 12fd52a5fc36aaaf 705058885fe8a557 48d691f6c5bdf6fc 1c9d494f4505f4d6 d9dc01802dec6cf7 79193e2b7c7c948c 8ce04556750adf05 06a401f5f05cefcd 4c492a48c97144ee 8a724204641faba0 b4dd9e1d9f0760cd  with fingerprint ssh-rsa 2048 40:71:a0:95:ed:0a:ac:5c:26:8c:ed:c9:7b:ac:a1:47
  . 2015-11-16 19:40:27.509 Host key matches cached key
  . 2015-11-16 19:40:27.509 Selecting events 63 for socket 1172
  . 2015-11-16 19:40:27.509 Host key fingerprint is:
  . 2015-11-16 19:40:27.509 ssh-rsa 2048 40:71:a0:95:ed:0a:ac:5c:26:8c:ed:c9:7b:ac:a1:47
  . 2015-11-16 19:40:27.509 Initialised AES-256 SDCTR client-&gt;server encryption
  . 2015-11-16 19:40:27.509 Initialised HMAC-SHA-256 client-&gt;server MAC algorithm
  . 2015-11-16 19:40:27.509 Initialised AES-256 SDCTR server-&gt;client encryption
  . 2015-11-16 19:40:27.509 Initialised HMAC-SHA-256 server-&gt;client MAC algorithm
  . 2015-11-16 19:40:27.509 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.509 Looking for incoming data
  . 2015-11-16 19:40:27.509 Looking for network events
  . 2015-11-16 19:40:27.605 Detected network event
  . 2015-11-16 19:40:27.605 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.605 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:27.605 Handling network read event on socket 1172 with error 0
  ! 2015-11-16 19:40:27.605 Using username &quot;user&quot;.
  . 2015-11-16 19:40:27.613 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.613 Looking for incoming data
  . 2015-11-16 19:40:27.613 Looking for network events
  . 2015-11-16 19:40:27.641 Detected network event
  . 2015-11-16 19:40:27.641 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.641 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:27.641 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:27.641 Attempting keyboard-interactive authentication
  . 2015-11-16 19:40:27.641 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.641 Looking for incoming data
  . 2015-11-16 19:40:27.641 Looking for network events
  . 2015-11-16 19:40:27.931 Detected network event
  . 2015-11-16 19:40:27.931 Enumerating network events for socket 1172
  . 2015-11-16 19:40:27.931 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:27.931 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:27.931 Prompt (keyboard interactive, &quot;SSH server authentication&quot;, &quot;Using keyboard-interactive authentication.&quot;, &quot;Password: &quot;)
  . 2015-11-16 19:40:27.931 Using stored password.
  . 2015-11-16 19:40:27.974 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:27.974 Looking for incoming data
  . 2015-11-16 19:40:27.974 Looking for network events
  . 2015-11-16 19:40:28.563 Detected network event
  . 2015-11-16 19:40:28.563 Enumerating network events for socket 1172
  . 2015-11-16 19:40:28.563 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:28.563 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:28.563 Prompt (keyboard interactive, &quot;SSH server authentication&quot;, &lt;no instructions&gt;, &lt;no prompt&gt;)
  . 2015-11-16 19:40:28.564 Ignoring empty SSH server authentication request
  . 2015-11-16 19:40:28.564 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:28.564 Looking for incoming data
  . 2015-11-16 19:40:28.564 Looking for network events
  . 2015-11-16 19:40:28.594 Detected network event
  . 2015-11-16 19:40:28.594 Enumerating network events for socket 1172
  . 2015-11-16 19:40:28.594 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:28.594 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:28.594 Access granted
  . 2015-11-16 19:40:28.594 Opening session as main channel
  . 2015-11-16 19:40:28.594 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:28.594 Looking for incoming data
  . 2015-11-16 19:40:28.594 Looking for network events
  . 2015-11-16 19:40:28.715 Detected network event
  . 2015-11-16 19:40:28.715 Enumerating network events for socket 1172
  . 2015-11-16 19:40:28.715 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:28.715 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:28.716 Server initiated key re-exchange
  . 2015-11-16 19:40:28.716 Using Diffie-Hellman with standard group &quot;group14&quot;
  . 2015-11-16 19:40:28.716 Doing Diffie-Hellman key exchange with hash SHA-1
  . 2015-11-16 19:40:28.803 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:28.803 Looking for incoming data
  . 2015-11-16 19:40:28.803 Looking for network events
  . 2015-11-16 19:40:28.842 Detected network event
  . 2015-11-16 19:40:28.842 Enumerating network events for socket 1172
  . 2015-11-16 19:40:28.842 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:28.842 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:28.907 Initialised AES-256 SDCTR client-&gt;server encryption
  . 2015-11-16 19:40:28.907 Initialised HMAC-SHA-256 client-&gt;server MAC algorithm
  . 2015-11-16 19:40:28.907 Initialised AES-256 SDCTR server-&gt;client encryption
  . 2015-11-16 19:40:28.907 Initialised HMAC-SHA-256 server-&gt;client MAC algorithm
  . 2015-11-16 19:40:28.907 Opened main channel
  . 2015-11-16 19:40:28.907 Waiting for the server to continue with the initialization
  . 2015-11-16 19:40:28.907 Looking for incoming data
  . 2015-11-16 19:40:28.907 Looking for network events
  . 2015-11-16 19:40:28.979 Detected network event
  . 2015-11-16 19:40:28.979 Enumerating network events for socket 1172
  . 2015-11-16 19:40:28.979 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:28.979 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:28.979 Started a shell/command
  . 2015-11-16 19:40:28.983 --------------------------------------------------------------------------
  . 2015-11-16 19:40:28.983 Using SFTP protocol.
  . 2015-11-16 19:40:28.984 Doing startup conversation with host.
  . 2015-11-16 19:40:28.984 Session upkeep
  . 2015-11-16 19:40:28.984 Looking for network events
  . 2015-11-16 19:40:28.984 Timeout waiting for network events
  &gt; 2015-11-16 19:40:29.034 Type: SSH_FXP_INIT, Size: 5, Number: -1
  &gt; 2015-11-16 19:40:29.034 01,00,00,00,06,
  . 2015-11-16 19:40:29.034 Sent 9 bytes
  . 2015-11-16 19:40:29.034 There are 0 bytes remaining in the send buffer
  . 2015-11-16 19:40:29.034 Looking for network events
  . 2015-11-16 19:40:29.034 Timeout waiting for network events
  . 2015-11-16 19:40:29.034 Waiting for another 4 bytes
  . 2015-11-16 19:40:29.034 Looking for incoming data
  . 2015-11-16 19:40:29.034 Looking for network events
  . 2015-11-16 19:40:29.050 Detected network event
  . 2015-11-16 19:40:29.050 Enumerating network events for socket 1172
  . 2015-11-16 19:40:29.050 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:29.050 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:29.050 Received 154 bytes (0)
  . 2015-11-16 19:40:29.050 Read 4 bytes (150 pending)
  . 2015-11-16 19:40:29.050 Read 150 bytes (0 pending)
  &lt; 2015-11-16 19:40:29.050 Type: SSH_FXP_VERSION, Size: 150, Number: -1
  &lt; 2015-11-16 19:40:29.050 02,00,00,00,03,00,00,00,18,70,6F,73,69,78,2D,72,65,6E,61,6D,65,40,6F,70,65,
  &lt; 2015-11-16 19:40:29.050 6E,73,73,68,2E,63,6F,6D,00,00,00,01,31,00,00,00,13,73,74,61,74,76,66,73,40,
  &lt; 2015-11-16 19:40:29.050 6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,32,00,00,00,14,66,73,74,61,74,
  &lt; 2015-11-16 19:40:29.050 76,66,73,40,6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,32,00,00,00,14,68,
  &lt; 2015-11-16 19:40:29.050 61,72,64,6C,69,6E,6B,40,6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,31,00,
  &lt; 2015-11-16 19:40:29.050 00,00,11,66,73,79,6E,63,40,6F,70,65,6E,73,73,68,2E,63,6F,6D,00,00,00,01,31,
  . 2015-11-16 19:40:29.050 SFTP version 3 negotiated.
  . 2015-11-16 19:40:29.050 Unknown server extension posix-rename@openssh.com=&quot;1&quot;
  . 2015-11-16 19:40:29.050 Supports statvfs@openssh.com extension version &quot;2&quot;
  . 2015-11-16 19:40:29.050 Unknown server extension fstatvfs@openssh.com=&quot;2&quot;
  . 2015-11-16 19:40:29.050 Supports hardlink@openssh.com extension version &quot;1&quot;
  . 2015-11-16 19:40:29.050 Unknown server extension fsync@openssh.com=&quot;1&quot;
  . 2015-11-16 19:40:29.050 We believe the server has signed timestamps bug
  . 2015-11-16 19:40:29.050 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
  . 2015-11-16 19:40:29.050 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
  . 2015-11-16 19:40:29.050 Getting current directory name.
  . 2015-11-16 19:40:29.050 Getting real path for '.'
  &gt; 2015-11-16 19:40:29.050 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
  &gt; 2015-11-16 19:40:29.050 10,00,00,00,10,00,00,00,01,2E,
  . 2015-11-16 19:40:29.050 Sent 14 bytes
  . 2015-11-16 19:40:29.050 There are 0 bytes remaining in the send buffer
  . 2015-11-16 19:40:29.050 Looking for network events
  . 2015-11-16 19:40:29.050 Timeout waiting for network events
  . 2015-11-16 19:40:29.050 Waiting for another 4 bytes
  . 2015-11-16 19:40:29.050 Looking for incoming data
  . 2015-11-16 19:40:29.050 Looking for network events
  . 2015-11-16 19:40:29.066 Detected network event
  . 2015-11-16 19:40:29.066 Enumerating network events for socket 1172
  . 2015-11-16 19:40:29.066 Enumerated 1 network events making 1 cumulative events for socket 1172
  . 2015-11-16 19:40:29.066 Handling network read event on socket 1172 with error 0
  . 2015-11-16 19:40:29.066 Received 33 bytes (0)
  . 2015-11-16 19:40:29.066 Read 4 bytes (29 pending)
  . 2015-11-16 19:40:29.066 Read 29 bytes (0 pending)
  &lt; 2015-11-16 19:40:29.066 Type: SSH_FXP_STATUS, Size: 29, Number: 16
  &lt; 2015-11-16 19:40:29.066 65,00,00,00,10,00,00,00,02,00,00,00,0C,4E,6F,20,73,75,63,68,20,66,69,6C,65,
  &lt; 2015-11-16 19:40:29.066 00,00,00,00,
  &lt; 2015-11-16 19:40:29.066 Status code: 2, Message: 16, Server: No such file, Language:  
  * 2015-11-16 19:40:29.066 (ECommand) Error getting name of current remote directory.
  * 2015-11-16 19:40:29.066 Cannot get real path for '.'.
  * 2015-11-16 19:40:29.066 No such file or directory.
  * 2015-11-16 19:40:29.066 Error code: 2
  * 2015-11-16 19:40:29.066 Error message from server: No such file
  </code></pre>