Super User is a question and answer site for computer enthusiasts and power users. 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

I have two users with valid SSH accounts on a server. Both users can login via ssh successfully.

When trying to mount SSHFS, usera can mount with no problems, while userb gets the error:

remote host has disconnected

after entering a valid password.

In the auth.log we get:

Apr 25 19:12:49 Ophelia sshd[26211]: Accepted password for userb from [ip address] port 44609 ssh2
Apr 25 19:12:49 Ophelia sshd[26211]: pam_unix(sshd:session): session opened for user userb by (uid=0)
Apr 25 19:12:49 Ophelia sshd[26240]: subsystem request for sftp
Apr 25 19:12:49 Ophelia sshd[26240]: Received disconnect from [ip address]: 11: disconnected by user
Apr 25 19:12:49 Ophelia sshd[26211]: pam_unix(sshd:session): session closed for user userb

I read that remote host has disconnected can be caused by an invalid sftp-server in /etc/ssh/sshd_config, but the path is set to /usr/lib/openssh/sftp-server which appears valid, and usera can use SSHFS just fine.

The server and client are Ubuntu 10.04.

Any suggestions?

share|improve this question

From the OpenSSH FAQ (via, English translation here):

sftp and/or scp may fail at connection time if you have shell initialization (.profile, .bashrc, .cshrc, etc) which produces output for non-interactive sessions. This output confuses the sftp/scp client. You can verify if your shell is doing this by executing:

ssh yourhost /usr/bin/true

If the above command produces any output, then you need to modify your shell initialization.

Also try ssh user@host /bin/true.

share|improve this answer
@Indrek How would I alter the shell initialization? And do I alter it on the remote host or local? – Don Rhummy Jan 31 '14 at 23:22
Pointing out the possibility of shell init. issues was just what I needed to resolve this issue (turned out I had accidentally stripped the last ' in my .bash_aliases). Thanks! – copper.hat Feb 28 '14 at 6:52
if you see something like "LC_ALL: cannot change locale" when performing a simple ssh, run export LC_ALL="" on the local machine before sshfs. Also, make sure there is no Banner defined in /etc/ssh/sshd_config on the remote host (and restart the remote sshd if there was one). – Mat Feb 28 '15 at 19:12
up vote 4 down vote accepted

I got it working... The permissions on the user's home folder were set incorrectly. Apparently this doesn't prevent ssh login, but does break sshfs.

share|improve this answer
so what changes did you have to make to the permissions ? – SMTF Apr 9 '13 at 22:32
What were your permissions before and after you did this? – dranxo Aug 4 '14 at 22:44

Make sure you remove host key from username/.ssh/known_hosts prior to connecting. I had a problem using sshfs and sysrescuecd (every boot gets new keys etc).

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.