问题
If we have a following situation:
[laptop] ---- [host1] ---- [target]
where host1 is reachable from the my laptop machine, the target from host1 only. We have ssh credentials to both host1 and target.
On the target I have an nfs export with the following properties:
/tmp/myshare 127.0.0.1/32(insecure,rw)
As we can see, I can only mount it locally, from the target machine. I can set up a dynamic tunnel:
ssh -J host1_user@host1 -D 127.0.0.1:8585 target_user@target
but when trying:
sudo proxychains mount /:tmp/myshare /mnt/share
I get:
mount.nfs: Failed to resolve server /: Name or service not known
I tried then local port forwarding:
ssh -fNv -J host1_user@host1 -L 3049:localhost:2049 target_user@target
When mounting with:
sudo mount -t nfs -o port=3049 localhost:/tmp/myshare
it times out. Is this a correct way?
来源:https://stackoverflow.com/questions/61433031/mount-nfs-share-via-a-hop-server