I want to be able to edit files locally using a nice IDE and have the files
on my local machine (~/Code/myproject
) get immediately pushed to the Ubuntu machine in the cloud (/home/ubuntu/myproject
).
I installed FUSE and SSHFS for my Mac OS X laptop (local) machine.
I have an Ubuntu 16.04 AWS instance on EC2:
ubuntu@ip-xxxxxx:~$ uname -a
Linux ip-xxxxxx 4.4.0-1017-aws #26-Ubuntu SMP Fri Apr 28 19:48:19 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ip-xxxxxxx:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
I use a .pem
file to SSH into that box with the -i
flag (haven't set up authorized_keys).
So here's what I do on local machine:
$ mount # check for mounted
/dev/disk1 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
$ sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/aws.pem,loglevel=debug \
ubuntu@ec2-xxxxxxxx.compute-1.amazonaws.com:/home/ubuntu/myproject \
/Users/me/Code/myproject
It prompts me for local machine password and then I see the following:
Password:
remote host has disconnected
Clearly, something has mounted though:
$ mount
/dev/disk1 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
ubuntu@ec2-xxxxxxx.compute-1.amazonaws.com:/home/ubuntu/myproject on /Users/me/Code/myproject (osxfuse, synchronous)
and if I try the same sshfs
command as above again (without unmoun
-ting) I get a different error:
mount_osxfuse: mount point /Users/me/Code/myproject is itself on a OSXFUSE volume
I can unmount and try again with sudo diskutil umount force /Users/me/Code/myproject/
but I get the same original error when I try again.
I thought perhaps it was a problem with my remote server's SFTP so I located all the sftp-server
location on the remote box:
$ sudo find / | grep sftp-server
...
/usr/lib/sftp-server
/usr/lib/openssh/sftp-server
And then I tried with both in my /etc/ssh/sshd_config
file with the line:
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp /usr/lib/sftp-server
but neither configuration after a reboot seems to work.
I can SFTP in with the following command:
$ sftp -i ~/.ssh/aws.pem ubuntu@ec2-xxx.compute-1.amazonaws.com
Connected to ec2-xxx.compute-1.amazonaws.com.
sftp>
EDIT: running the debug3
loglevel gives relatively the same results:
$ sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/aws.pem,loglevel=debug3 ubuntu@ec2-xxxx.compute-1.amazonaws.com:/home/ubuntu/myproject /Users/me/Code/myproject
sudo: cannot get working directory
The authenticity of host 'ec2-xxx.compute-1.amazonaws.com (xx.xx.xx.xx)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
remote host has disconnected
Any ideas on what to fix / where the issue could be?