sshfs is failing with "remote host has disconnected"

27

1

I'm running sshfs with the following:

sshfs basicuser@192.168.1.111:/var/www/myapp /home/basicuser/code -o sftp_server="/usr/bin/sudo /usr/libexec/openssh/sftp-server"

I have also created RSA keys so I can log in via ssh without password prompt (I tested this and it works).

I have also added the user to the sudoers file to run the sftp-server without a password:

basicuser  ALL=(ALL)  NOPASSWD:  /usr/libexec/openssh/sftp-server

What could be causing this error? How do I figure that out?

Edit

I am trying to mount a folder on the local computer from the remote server. On the remote server, only root has read/write permissions to that folder.

Remote folder: /var/www/myapp (is root only read/write)

Don Rhummy

Posted 2014-01-31T23:20:57.687

Reputation: 552

Why do you need sftp-server on the server to run as root? – Dan D. – 2014-01-31T23:38:42.887

@DanD. The folder that I'll be mounting on the local computer is root-only on the remote server. – Don Rhummy – 2014-01-31T23:57:36.073

Answers

3

It was requiring tty (this basically means something cannot be run in the background, but needs an active terminal window to run). So I added the following to /etc/sudoers (edited by doing visudo):

Defaults:basicuser !requiretty

I want it to not require tty only for that one command, but it may not be possible to do that: https://unix.stackexchange.com/a/80159

Don Rhummy

Posted 2014-01-31T23:20:57.687

Reputation: 552

45

You get a lot more information about the failure if you run sshfs as:

sshfs -odebug,sshfs_debug,loglevel=debug user@host ...

Usually this will give you something a lot more helpful to debug the problem.

Alex Hofsteede

Posted 2014-01-31T23:20:57.687

Reputation: 1 241

0

Thanks, @Alex Hofsteede for the debugging info.
my problem was that I was using a custom cipher, the Blowfish cipher.
command-line line 0: Bad SSH2 cipher spec 'blowfish-cbc'.
I removed the custom cipher and it worked.

codenamejames

Posted 2014-01-31T23:20:57.687

Reputation: 101

1why are you posting this as an answer? this should be a comment on his answer – Don Rhummy – 2018-01-14T08:01:34.953

1It is an answer to remote host disconnected question. What could be causing this error? How do I figure that out? It just didn't happen to be the answer the OP was looking for. However i had the same question and this was my answer. – codenamejames – 2018-01-16T15:07:58.373

@codenamejames The process to determine your specific issue was the answer. Your comment is orphaned and forces others to backtrack your "answer" to the one that will actually help the other 90% of users without a broken Blowfish cipher. – Abandoned Cart – 2019-12-23T14:12:38.423