Maybe the title must be changed but I have the following situation:
I can ssh to a host A
From A, I can ssh into a machine B, but this machine cannot be accessed from my computer. The name of the machine (as well as its ip) is local only.
How can I sshfs (and/or use scp) directly to machine B, without having to scp files from B->A and then from A->my machine. I'm really loosing productivity that way,
PS: I can't change configs in A nor B...
Answer
If you authenticate to B with credentials accessible on your computer (let’s call it W), for example a password/username tuple (rather than keys on A), you can build a SSH tunnel, for example:
W $ ssh -L 1234:B:22 A
and then
W $ ssh -p 1234 usernameB@127.0.0.1
or similarly with scp and sshfs. I. e. port 1234 on your local machine (usually 127.0.0.1 or ::1) is forwarded to B, port 22 from the perspective of A.
No comments:
Post a Comment