terminus-plugin-project / terminus-site-mount-plugin

Site Mount - A Terminus plugin to mount Pantheon sites.
https://packagist.org/packages/terminus-plugin-project/terminus-site-mount-plugin
MIT License
5 stars 2 forks source link

SSHFS doesn't seem to work as expected #1

Open kourylape opened 7 years ago

kourylape commented 7 years ago

The environment mounts perfectly, but I cannot edit any of the files because of permission denied. Also the -o IdentityFile=<path_to_key seems to be required otherwise it prompts for your Pantheon account password.

My setup:

OSX: 10.11.6
SSHFS version 2.5 (OSXFUSE SSHFS 2.5.0)
OSXFUSE 3.5.8
FUSE library version: 2.9.7

I get permission denied when trying to edit files when using the plugin as well as:

sudo sshfs -p 2222 -o IdentityFile=<path_to_key>,allow_other,reconnect env.site@appserver.env.site.drush.in:code <local_path>

I get Operation not supported on socket when trying to edit when using:

sshfs -p 2222 -o IdentityFile=<path_to_key>,reconnect env.site@appserver.env.site.drush.in:code <local_path>

Oddly enough, when I use the following and edit a line or two:

vim <local_sshfs_path>/CHANGELOG.txt

It works and uploads fine, but nano, Atom, and PhpStorm have issues.

uberhacker commented 7 years ago

Hey @ckylape: Thank you for the feedback. How did you install sshfs? Did you use brew or some other method? Is this the latest version of the software for your system? If not, you might try updating to the latest version and see if that makes a difference.

kourylape commented 7 years ago

@uberhacker - I got it from https://osxfuse.github.io/ which was a few versions behind compared to the homebrew package, so I just tried the latest version of sshfs via brew and got the same results.

uberhacker commented 7 years ago

@ckylape: What happens if you try to mount in a directory other than /tmp (the default)? Try something like terminus mount my-site.env --dir=~/.

kourylape commented 7 years ago

Same. I've tried /tmp, /Volumes, and ~/mounts. It's also interesting because I've tested a similar sshfs command on 5+ other sites and everything works fine. These SFTP servers range from AWS EC2, GoDaddy, WP Engine, and a QNAP NAS.

Update: @uberhacker It seems to be an issue with either my version of OSX or SSHFS. I just tried the same command on a Linux stack and it worked fine. I'm going to try checking on OSX 10.12 as well as SSHFS 2.4 on 10.11 (2.5+ seems to have major changes).

uberhacker commented 7 years ago

Yeah, you might have better luck with older versions. Do you have any trouble connecting to the same site environment using the Terminus Filer Plugin? If not, then the problem is most likely not ssh but rather fuse/sshfs specific.

kourylape commented 7 years ago

@uberhacker It seems like it's an issue with Pantheon's servers and sshfs on OSX. I tried the following:

The plugin (or raw sshfs commands) did not work on any of those versions.

I did get it to work though after adding -o workaround=truncate to sshs. I will have to do some more testing, but it might also need the rename workaround. I'm thinking that it's a server issue since the man sshfs shows:

-o workaround=LIST
    colon separated list of workarounds

    none   no workarounds enabled

    all    all workarounds enabled

    [no]rename
         fix renaming to existing file (default: off)

    [no]nodelaysrv
        set nodelay tcp flag in ssh (default: off)

    [no]truncate
        fix truncate for old servers (default: off)

    [no]buflimit
        fix buffer fillup bug in server (default: on)

My final command looks like:

sshfs -o IdentityFile=<PATH_TO_KEY>,allow_other,reconnect,workaround=truncate -p 2222 <ENV>.<SITE_UID>@appserver.<ENV>.<SITE_UID>.drush.in:code ~/
uberhacker commented 7 years ago

Nice find. I suppose it wouldn't hurt if you just used workaround=all? Not sure why you would need the IdentityFile=... option since the default is ~/.ssh/id_rsa.

kourylape commented 7 years ago

The IdentityFile seems to required with older versions of sshfs (2.5 and lower - at least on OSX). The nodelaysrv seems to slow down the connection IMO so the workaround=truncate:rename seems a little better. Thanks for the feedback/help.