Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

From the OpenSSH FAQ (via knoppixforum.de, 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 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 at 6:52
up vote 3 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
18  
so what changes did you have to make to the permissions ? –  SMTF Apr 9 '13 at 22:32
1  
What were your permissions before and after you did this? –  dranxo Aug 4 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

 
discard

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.