I have three computers HOME, WORK and SERVER and I am connected from HOME to SERVER by:
ssh -t <WORKusername>@<WORK> ssh -p23456 <SERVERusername>@localhost
I need to transfer the file from HOME to SERVER but I am not able to leave the file in WORK
Also I would need to transfer a file from the SERVER to HOME after processing it, how do i do it?
I have took a look at https://serverfault.com/questions/37629/how-do-i-do-multihop-scp-transfers and scp between two remote hosts from my (third) pc but i am unable to change the ssh config on the HOME machine
And i've tried this but i got nowhere:
$ scp -o ProxyCommand="ssh <WORKusername>@<WORK> nc localhost" ASPEC.zip <SERVERusername>@localhost:~/
<WORKusername>@<WORK>'s password:
This is nc from the netcat-openbsd package. An alternative nc is available
in the netcat-traditional package.
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-P proxy_username] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
[-x proxy_address[:port]] [hostname] [port[s]]
ssh_exchange_identification: Connection closed by remote host
lost connection
I've also tried the following but this is the reverse to transfer file from SERVER -> HOME:
ssh -t <WORKusername>@<WORK> "ssh -p 23456 <SERVERusername>@localhost \"cat file.zip\""
I've also tried tar but it didn't work:
tar c file.zip | ssh -t <WORKusername>@<WORK> "ssh -p 23456 <SERVERusername>@localhost | tar x"
Pseudo-terminal will not be allocated because stdin is not a terminal.
<WORKusername>@<WORK>'s password:
Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Then I tried:
# From home:
$ ssh -L 23456:<SERVERusername>@localhost:22 <WORKusername>@<WORK>
# After ssh, in WORK:
$ ssh -p 23456 <SERVERusername>@localhost
# From home:
$ scp -P file.zip <SERVERusername>@localhost:~/
And i got these error when i give the scp command,
# on WORK terminal:
channel 3: open failed: administratively prohibited: open failed
# on SERVER terminal:
ssh_exchange_identification: Connection closed by remote host
lost connection
I've also tried rsync but it didn't work:
rsync -e "ssh -A -t <WORKusername>@<WORK>e ssh -p23456 <SERVERusername>@localhost" file.zip :~/
How can I scp from HOME to transfer a file to SERVER?
And also from SERVER to HOME?