无法使用sshfs在Google Compute Engine上挂载目录

Aja*_*jax 4 sshfs google-compute-engine google-cloud-platform

我正在尝试在Google Container Engine上安装远程文件系统。我正在关注本教程:https : //www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh

使用以下sshfs命令:

sudo sshfs -o sshfs_debug,allow_other <instance-name>.<region>.<project_id>:/home/<user_name> /mnt/gce-container
Run Code Online (Sandbox Code Playgroud)

我收到错误消息:

SSHFS version 2.5
read: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)

我引用了此链接https://cloud.google.com/sdk/gcloud/reference/compute/config-ssh ,可以通过以下命令使用ssh登录:

$gcloud compute config-ssh
$ssh <instance-name>.<region>.<project_id>
Run Code Online (Sandbox Code Playgroud)

有什么想法可能出什么问题吗?我不明白我应该使用什么密钥和用户名登录sshfs。

更新(11/5):我正在使用以下命令:

sshfs -o IdentityFile=~/.ssh/google_compute_engine <user>@<ip>:~/  /mnt/gce`
Run Code Online (Sandbox Code Playgroud)

我为我的用户更改了/ mnt / gce文件夹。我检查了IP是否与〜/ .ssh / config文件中的条目匹配。但是我仍然收到错误read: Connection reset by peer

Aja*_*jax 6

以下命令的问题是

1)除非您有静态IP,否则它在计算机重新启动时会不断变化

2)您需要使用.pub文件

sshfs -o IdentityFile=~/.ssh/google_compute_engine <user>@<ip>:~/  /mnt/gce
Run Code Online (Sandbox Code Playgroud)

我终于通过以下命令使其工作:

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
Run Code Online (Sandbox Code Playgroud)