Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This was working well until a couple of days ago. I can't recall having done anything to the server leading it to start closing the connection. Also I have no idea what exitcode 128 means, and can't find anything about it. Here's FileZilla's response to the connection attempt

Status: Connecting to
Response:   fzSftp started
Command:    open "" 22
Command:    Pass: *******
Status: Connected to
Error:  Connection closed by server with exitcode 128
Error:  Could not connect to server

Trying to connect with WinSCP also tells me the server closed the connection with error code 128 and additionally tells me:

Cannot initialize SFTP protocol. Is the host running a SFTP server?

I can SSH connect to the server no problem using PuTTY. Any ideas?

share|improve this question

It might be an invalid .bashrc file. In my case I found it was referencing another recently deleted script, and so failed.

share|improve this answer

According to this site:, the problem is a bad username/password combination.

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Mark Henderson May 24 '13 at 12:11
Not according to that site. – d-_-b Jul 31 '13 at 6:43

Since it was working before, have you tried restarting the service? Another thing that you may want to try is using passive mode for your connection. Also, try either resetting the password or creating a new user account (your current account may be locked).

share|improve this answer
I've tried rebooting the server and using passive mode. I've also tried changing the password which I don't see why would have worked, since I can log into SSH using PuTTY. Also this is the root account, so how can it be locked? :P – Hubro Jan 20 '12 at 2:29

Looks like a permissions issue to me. Can your user account access whatever ftp folder your configured to access at login time? Do both you and root (or whatever account is running the ftp/ssh services) have access to your home directory and/or custom ftp directory?

share|improve this answer
My user account is root :P In addition, this netstat line shows that root is also running ssh tcp 0 0* LISTEN root 3960 1130/sshd. – Hubro Jan 20 '12 at 2:31

I had the same problem with one domain on my linux RHEL server. (My server requires ssh for security reasons.) I tried changing login and password and everything else.

What finally fixed it was in my WHM control panel, I disabled Shell Fork Bomb Protection. This feature limits ftp connections if there is a lot of traffic on the domain. When I disabled this, the ftp started working immediately and has worked ever since.

It has nothing to do with Filezilla or SCP setup. It is a matter or resources.


share|improve this answer

If you are using ssh and scponlyc (chrooted), then you'll need to add the following line to /etc/ssh/sshd_config:

ForceCommand internal-sftp

man sshd_config

ForceCommand Forces the execution of the command specified by ForceCommand, ignoring any command supplied by the client and ~/.ssh/rc if present. The command is invoked by using the user's login shell with the -c option. This applies to shell, command, or sub‐ system execution. It is most useful inside a Match block. The command originally supplied by the client is available in the SSH_ORIGINAL_COMMAND environment variable. Specifying a command of “internal-sftp” will force the use of an in-process sftp server that requires no support files when used with ChrootDirectory.
share|improve this answer

Your Answer


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.