![]() So in your case of A->BC it allows to connect to each node at C's network: A->B. It works with scp and ssh.Īnother more general option might be sshuttle utility which appears to be a kind of transparent proxy (vpn over ssh). Of course you may use above to ssh directly to the target: ssh TARGET_HOST. It displays double banners from both the hop and target nodes but it works. Prox圜ommand ssh -W %h:%p that the copy operation is as simple as: scp FILE TARGET_HOST. ssh/config a little by adding following entry: Host TARGET_HOST Usually you would expect it is the HOP public key you have to add to the TARGET one. Yes, the same public key from the home host to both of them. ssh/authorized_keys at both hop and target hosts. TARGET_HOST: it is our destination (authenticated as TARGET_USER)įirst I added my local public key from my home host.HOP_HOST: we copy through this host (logged as HOP_USER).HOME_HOST: it is from where we copy a file to the target host.Based on OpenSSH Proxies and Jumphost Cookbook I crafted a following configuration: Nearly all have been already said but here is my last penny: I use Prox圜ommand variant without nc nor soc. -R Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the given host and port, or Unix socket, on the local side.(now you can reach A from B, by using localhost:4567)ī$ scp -P 4567 localhost:thefile C:destination This is useful for just forwarding ports.ĭoesn't always work though: A$ ssh -f -N -R 4567:localhost:22 B This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. -f Requests ssh to go to background just before command execution.When you're done, don't forget to kill the previously started ssh process (which has dropped to background due to -f -N). "Tunnel" through B A$ ssh -f -N -L 4567:C:22 BĪ$ scp -P 4567 thefile localhost:destinationPath Pipes A$ tar cf - thefile anotherfile | ssh B "ssh C \"cd destination & tar xvf -\""Ī$ (echo thefile echo anotherfile) | cpio -o | ssh B "ssh C \"cd destination & cpio -i\""įor just one file: A$ ssh B "ssh C \"cd destination & cat > thefile\"" < thefile If A has a very old SSH client installed (without -W support), or if B is configured to disallow TCP forwarding (but still allows shell commands), use alternatives: A$ scp -oProx圜ommand="ssh B socat stdio tcp:%h:%p" thefile C:destinationĪ$ scp -oProx圜ommand="ssh B nc %h %p" thefile C:destination ![]() Updated to include -W from other answers: A$ scp -oProx圜ommand="ssh -W %h:%p B" thefile C:destination (Behind the scenes, this just uses Prox圜ommand and ssh -W.) Prox圜ommand ![]() New in OpenSSH 7.3: A$ scp -oProxyJump=B thefile C:destination ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |