Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh_command option fails if multiple spaces in command #114

Closed
dustymabe opened this issue Feb 12, 2018 · 1 comment
Closed

ssh_command option fails if multiple spaces in command #114

dustymabe opened this issue Feb 12, 2018 · 1 comment

Comments

@dustymabe
Copy link

Version of SSHFS: fuse-sshfs-2.8-4.fc27.x86_64 on Fedora

First off, I ended up going down this path because sshfs didn't recognize an option I was trying to pass it:

[dustymabe@hattop f27 (master *%=)]$ /usr/bin/sshfs -o AddKeysToAgent=no -o IdentityFile=/guests/sharedfolder/code/github.com/dustymabe/vagrantdirs/vanilla/f27/.vagrant/machines/f27vanilla/libvirt/private_key vagrant@192.168.121.241:/etc ./etc/
fuse: unknown option `AddKeysToAgent=no'
[dustymabe@hattop f27 (master *%=)]$ 
[dustymabe@hattop f27 (master *%=)]$ man ssh_config | grep AddKeysToAgent
     AddKeysToAgent

So I decided to work around things by using ssh_command:

[dustymabe@hattop f27 (master *%=)]$ /usr/bin/sshfs -o ssh_command='ssh  -o AddKeysToAgent=no -o IdentityFile=/guests/sharedfolder/code/github.com/dustymabe/vagrantdirs/vanilla/f27/.vagrant/machines/f27vanilla/libvirt/private_key'    vagrant@192.168.121.241:/etc ./etc/
read: Connection reset by peer

The problem here is that I accidentally typed multiple spaces into the ssh_command at one point. This yields a Connection reset by peer. All I had to do to fix it was go from ssh -o to ssh -o. i.e. remove the extra space.

We should be more tolerant to extra spaces in the ssh command as it is common (especially in scripting languages) to splice together the ssh command from several different options and extra spaces could be in there pretty easily.

dustymabe added a commit to dustymabe/vagrant-sshfs that referenced this issue Feb 12, 2018
This is because I got an error telling me it didn't know about
the AddKeysToAgent ssh_config option.

Also had to workaround the fact that ssh_command doesn't handle
extraneous spaces well.

See libfuse/sshfs#114
@Nikratio
Copy link
Contributor

Thanks for the report! Yes, this sounds reasonable.

mssalvatore added a commit to mssalvatore/sshfs that referenced this issue Apr 7, 2019
When using the "ssh_command" option, commands with multiple spaces in a
row will not be properly parsed. Example:

Properly parsed:
    ssh_command = "ssh -o IdentityFile=~/.ssh/id_rsa"

Improperly parsed:
    ssh_command = "ssh -o      IdentityFile=~/.ssh/id_rsa"

This commit changes the ssh_command parsing logic so that both of the
above examples are considered valid and properly handled. Resolves libfuse#114.
mssalvatore added a commit to mssalvatore/sshfs that referenced this issue Apr 7, 2019
When using the "ssh_command" option, commands with multiple spaces in a
row will not be properly parsed. Example:

Properly parsed:
    ssh_command = "ssh -o IdentityFile=~/.ssh/id_rsa"

Improperly parsed:
    ssh_command = "ssh -o      IdentityFile=~/.ssh/id_rsa"

This commit changes the ssh_command parsing logic so that both of the
above examples are considered valid and properly handled. Resolves libfuse#114.
mssalvatore added a commit to mssalvatore/sshfs that referenced this issue Apr 8, 2019
Nikratio pushed a commit that referenced this issue Apr 8, 2019
When using the "ssh_command" option, commands with multiple spaces in a
row will not be properly parsed. Example:

Properly parsed:
    ssh_command = "ssh -o IdentityFile=~/.ssh/id_rsa"

Improperly parsed:
    ssh_command = "ssh -o      IdentityFile=~/.ssh/id_rsa"

This commit changes the ssh_command parsing logic so that both of the
above examples are considered valid and properly handled. 

Fixes: #114.
mssalvatore added a commit to mssalvatore/sshfs that referenced this issue Apr 8, 2019
Nikratio pushed a commit that referenced this issue Apr 9, 2019
When using the "ssh_command" option, commands with multiple spaces in a
row will not be properly parsed. Example:

Properly parsed:
    ssh_command = "ssh -o IdentityFile=~/.ssh/id_rsa"

Improperly parsed:
    ssh_command = "ssh -o      IdentityFile=~/.ssh/id_rsa"

This commit changes the ssh_command parsing logic so that both of the
above examples are considered valid and properly handled. Resolves #114.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants