4

The situation:

  • I am working from machine1, where I have root access. From machine1 I can access machine2 (where I am a user with no privileges) through ssh.
  • machine3 (also user with no privileges) is not directly accessible from machine1. I need to use an ssh connection from machine2 to access machine3.
  • In short: machine1 can ssh into machine2 but not into machine3. machine2 can ssh into machine3.

What I want to do:

  • I want to use sshfs to mount on machine1 a local (own) directory located on machine3.

Complications:

  • sshfs is not available on machine2.

How can this be done?

4

2 回答 2

8

您可以使用 ssh 通过 machine2 将端口 22 从 machine3 转发到 machine1,例如

user1@machine1:$ ssh -L 2222:machine3:22 user2@machine2

之后在 machine1 上配置 sshfs 以使用localhost:2222端口(在第二个终端选项卡中):

user1@machine1:$ sshfs user3@localhost:/some/machine3/dir /some/local/dir -p 2222
于 2013-11-13T10:09:35.697 回答
1

理论上,通过sshfs将机器3挂载到机器2上,然后将机器2的sshfs目录挂载到机器1上。

作为无特权用户,您只能在主目录中创建文件夹。

所以理论上,这应该有效(但速度很慢):

机器2:

mkdir /home/<username>/sshfs
sshfs <machine3_username>@machine3:/ /home/<username>/sshfs

机器1:

mkdir -p /mnt/sshfs
sshfs <machine2_username>@machine2:/home/<username>/sshfs /mnt/sshfs
于 2013-11-13T10:07:16.637 回答