Client A -- Server B -- Server C
There are network configurations such as .Client A does not have direct access to server C.
In such a configuration, if you try to scp the file from client A to server C,
1. Place the file in scp from client A to server B
2. Log in to server B from client A with ssh
3. Place the file in scp from server B to server C
4.Delete server B files
The following steps are performed:
As it is very troublesome, I am wondering if I can put the file on server C (via server B) only by using client A.
If you know a good way, I would appreciate it if you could let me know.
scp
There are two ways you can think of it.
I think 2 is probably closer to what I want to do, so I'll give you a reference site to realize it. I'll show you.
https://dev.classmethod.jp/beginners/direct-ssh-by-proxycommand/
https://qiita.com/S-T/items/18af2bfcc4e5a72202da
However, if the inter-server configuration is not correct, you may fall for it, so be careful.
Add one of them to Client A's through /.ssh/config
.
ProxyCommand
1:
Host<Server B>
User <B Login ID >
Host <Server C>
User <C Login ID >
ProxyCommand ssh<Server B>nc%h%p
ProxyCommand
available in 5.4 and later:
Host<Server B>
User <B Login ID >
Host <Server C>
User <C Login ID >
ProxyCommand ssh-W%h:%p<Server B>
ProxyJump
(available in 7.3 and later):
Host<Server B>
User <B Login ID >
Host <Server C>
User <C Login ID >
ProxyJump<Server B>
Example Execution:
scp myfile<Server C>:./myfile
Note:
OpenSSH/Cookbook/Proxies and Jump Hosts-Wikibooks, openbooks for an open world
I think ssh(1) and ssh_config(5) are applicable for man.
© 2024 OneMinuteCode. All rights reserved.