5

I am trying to mount a remote filesystem on Google Container Engine. I am following this tutorial: https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh

Using following sshfs command:

sudo sshfs -o sshfs_debug,allow_other <instance-name>.<region>.<project_id>:/home/<user_name> /mnt/gce-container

I am getting error:

SSHFS version 2.5
read: Connection reset by peer

I referred this link https://cloud.google.com/sdk/gcloud/reference/compute/config-ssh and could login using ssh via following command:

$gcloud compute config-ssh
$ssh <instance-name>.<region>.<project_id>

Any ideas what might be going wrong here? I can't understand what keys and username should I use for sshfs login.

Update(11/5): I am using following command:

sshfs -o IdentityFile=~/.ssh/google_compute_engine <user>@<ip>:~/  /mnt/gce`

I have chowned /mnt/gce folder for my user. I checked the IP matches the entry in ~/.ssh/config file. However I still get the error read: Connection reset by peer

Ajax
  • 1,438
  • 3
  • 17
  • 26

3 Answers3

7

The problem with command below is that

1) unless you have a static IP, it keeps changing on machine reboot

2) you need to use .pub file

sshfs -o IdentityFile=~/.ssh/google_compute_engine <user>@<ip>:~/  /mnt/gce

I finally got it working by following command:

sudo mkdir /mnt/gce
sudo chown <user> /mnt/gce

sshfs -o  IdentityFile=~/.ssh/google_compute_engine.pub <user_name>@<instance-name>.<region>.<project_id>:/home/<user_name> /mnt/gce
Ajax
  • 1,438
  • 3
  • 17
  • 26
  • running sudo chown /mnt/gce made all the difference for me since running sshfs with sudo did not work, thanks! – maskarih May 12 '19 at 17:54
0

A few things that might be the cause of the problem:

  • Don't use sshfs as root. It's a FUSE filesystem and meant to be user mounted.
  • Don't specify a full path as the remote FS. It's SSH, so by default, the $PWD on the remote side is the login user's $HOME.

if ssh works, sshfs will work. The easiest way is to make sure that ~/.ssh/config has an entry for the remote host with the user, port, etc provided.

George
  • 1,022
  • 8
  • 17
0

If you get this from sshfs

read: Connection reset by peer

maybe help to set file to read only

chmod 400 /{{path_to_your_key}}/keypair.pem

and connect again.

BG BRUNO
  • 5,012
  • 4
  • 37
  • 46