SFTP connection closed by server with exitcode 141


My account can only connect through SSH and FTP or SFTP, but not both SSH and SFTP under the same user setting.

My account has only ever had one single user with “Shell account access” and “Disallow FTP” is NOT checked. I have tried this with my own domain name and with giancana.dreamhost.com as the connection host. Lately I can only connect through regular FTP while shell access is still enabled.

If I change my user account type to “SFTP”, then I still get the Giancana SSH welcome message in the terminal, but no prompt and the only command that works is “exit”. However SFTP works just fine then. If I leave Filezilla’s settings as they are, change my user account type back to the desired Shell access (still NOT disallowing FTP), confirm with a working SSH prompt, and try to reconnect with Filezilla using SFTP, then once again I get:

[quote]Response: fzSftp started
Command: open "glottus@glottus.com" 22
Status: Connected to glottus.com
Error: Connection closed by server with exitcode 141
Error: Could not connect to server[/quote]

I want SSH access and SFTP at the same time, what is wrong with my account? How can I get both secure connections working again?


Since this issue has gotten some views, but no replies, I wanted to document my (partial) solution here:

I had started getting exit code 128 now (instead of 141). I don’t fully understand what they mean, but googling this new message brought me here: http://forum.filezilla-project.org/viewtopic.php?f=2&t=17604

I seem (vaguely) to recall seeing an error message relating to an alias, but shell access still worked. This thread (above) indicates that FileZilla failed on such an error even when shell access worked, so I started by commenting out my alias declarations in my .bashrc file. That didn’t work, so I renamed the .bashrc to .bashrc-old, and tried again. SUCCESS!

I still don’t know exactly which line in the .bashrc file is causing the issue, and I’d like to reinstate it once I have time to test the various lines, but for now SFTP works as desired.


This sort of issue typically indicates that you had something in your .bashrc that was generating output — this messes up SFTP, which ends up trying to interpret that output as part of the SFTP handshake.

If you have stuff you want to run and display output on login, put it in .bash_profile instead.