spantaleev / sftpman

Application that handles sshfs/sftp file systems mounting.
GNU General Public License v3.0
32 stars 7 forks source link

Closing single quote wrong in sshfs command #5

Closed kamzata closed 7 years ago

kamzata commented 7 years ago

Closing single quote wrong in sshfs command option gives "Connection reset by peer" error message on connecting.

spantaleev commented 7 years ago

What does this solve?

Currently all these ssh_opts are part of the the SSH command (they are options for ssh, not for sshfs). That's why we're passing them like this: -o ssh_command='ssh <here>'.

I haven't seen this cause trouble yet.

In one of your examples in your sftpman-gtk bug report, it seemed like you were trying to (manually?) pass an invalid option inside it (-o sshfs_debug). This is an SSHFS option, not an SSH option, so it should not be inside those quotes.


What this current pull request does is, it moves all SSH options out of the -o ssh_command='ssh <ssh options here>' and puts them outside (as options to the main sshfs command).

This is completely different than what is intended (passing the SSH command options to the SSHFS command instead). However, it seems like it won't cause any trouble, because if SSHFS does not recognize an option, it would forward it to the underlying SSH command.

But then, it seems unnecessary to keep -o ssh_command='ssh' at all in this case, because that's the default anyway. It could be removed.

In any case, the question is: why should we be moving these ssh_opts options outside? Looking at the code, these ssh_opts could only ever contain something like: -o PreferredAuthentications=password or -o PreferredAuthentications=publickey -i /path/to/key/here.

kamzata commented 7 years ago

My mistake, you are right. So the follow command works:

[kamzata@pc /]$ true && sshfs -o ssh_command='ssh -o ConnectTimeout=8 -p 12345 -o PreferredAuthentications=password' -o sshfs_debug dev@www.example.com:/var/www /mnt/sshfs/www
SSHFS version 2.8
dev@www.example.com's password:
spantaleev commented 7 years ago

No problem. Thanks for spending the time investigating! :)

Did you figure out what the real reason for the Connection reset by peer problem was in your case? My proposal for using -o sshfs_debug was just to get more information and figure that one out.