A small trick about shfs

A small trick of using shfs:

shfsmount -ps –cmd=”ssh -l username FirstMachine login2″ username2@SecondMachine /path/to/mount -o cachesize=256

Explanation:
My goal: from my home Linux box, I want to mount the remote filesystem on SecondMachine by using the shfs kernel module. However, SecondMachine is behind of firewall, the only way to connect to this machine is to hop from the FirstMachine.

From the manual page of shfsmount, I figured out that –cmd=”foo” provides an alternative to the standard ssh tunnel, and here “foo” is ssh -l username FirstMachine login2, where the first part “ssh -l username FirstMachine” is self-explanatory, “login2” is actually a piece of script locates on the FirstMachine, with the content like this:

ssh -l username2 SecondMachine /bin/bash

So login2 actually provides a usable shell as well as an ssh connection to be used by shfs on my home Linux box.

,

  1. 发表评论

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: