I am trying to write a bash script to ssh first into IP1(asks for a password) from my localhost machine and then ssh into IP2. Once in IP2 I want to scp to my local machine.
IP1=192.168.10.10
IP2=192.168.10.9
ssh root@$IP1
ssh root@$IP2
cd /var/log
scp message* localuser@$localIP:/home/localuser/Desktop/MessageFolder/
The above is what I currently have to do manually via the command line in Linux
I do not have direct access to IP2. Think of it as a backdoor. IP2 has a password, IP1 does not.
Is there any way to do this? I have more code written if this isn't helpful.
Can someone verify if I can do something similar to what was done for this solution: https://superuser.com/questions/174160/scp-over-a-proxy-with-one-command-from-local-machine
I've also heard of port forwarding... How would that work with this example?
I'm very new to bash scripting and would appreciate some patience
Thank you.