I have two remote nodes that I am trying to send files from one to another.
scp remote1:~/testSCP email@example.com:~/
~/ssh/config set up in my local machine so, it is using port
2222 by default.
But the remote1's default ssh port is set to
22 in the ssh config instead of port
2222. So, to make any external connection via ssh, it uses port
22 by default.
I tried the following which did not work:
scp -P 2222 remote1:~/testSCP firstname.lastname@example.org:~/
Also tried the following, which also did not work:
scp remote1:~/testSCP -P 2222 email@example.com:~/
For both I got the following error:
ssh: connect to host 10.0.1.10 port 22: Connection refused lost connection
Which is true since
10.0.1.10 is using port
2222 and not port
How can I specify remote1 to use port
2222 when trying to send files to
10.0.1.10 (remote2) from
scp -3 remote1:~/testSCP firstname.lastname@example.org:~/
I get weird behaviour. Even though my password is correct, it is giving me the following output:
email@example.com's password: firstname.lastname@example.org's password: Permission denied, please try again. email@example.com's password: Permission denied, please try again. firstname.lastname@example.org's password:
I have not enabled key-less authentication yet.
After trying it in several ways, I was able to do it in my scripts by logging in to the remote1 via ssh from my localhost and then scp from remote1 to remote2. However, this does not answer my question. I intended upon doing it directly from my local machine then transfer files between two instances, which I think is not supported if two instances' ssh daemons are using a different port than the default for ssh connection.