I'm trying to get a file from server1 (localhost) with scp. I am accessing server1 from the gateway server2 (that is the only one accessible from the internet).
I am able to open a ssh connection by using:
ssh -p 2222 -L 8080:localhost:443 myUser@server2
And by googling I found that the scp command should be something like:
scp -P 2222 myUser@127.0.0.1:/sourcePathToFile/file destinationPathToFile
But what I get is
ssh: connect to host 127.0.0.1 port 2222: Connection refused
These are the entries in /etc/hosts
127.0.0.1 localhost
127.0.1.1 server3
What am I doing wrong?