SSH and SCP problems

Hi.

I'm trying to create an automated script to copy files from one server to another using scp. I've set up the keys and I can successfully ssh into the other server with no password needed, so my keys are working.

When I try to scp, it asks for a password, when I don't want it to, and even when I type the correct password, I get the following error:
ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused
lost connection​

Here's the command I use:

I'm telling scp to use a different port, but it keeps saying refused on port 22.

I don't know where to go next. I haven't touched the ssh_config files, so there may be something there, but I'm not sure what I would be looking for.
 
What you're doing here is a three way copy: myserver.com -> localhost -> xxx.xxx.xxx.xxx
So you're connecting on port 2222 on myserver.com and then copy it to you local machine and then copy it to xxx.xxx.xxx.xxx on port 22.
What you could try is to add this on myserver.conf/.ssh/config:
Code:
Host xxx.xxx.xxx.xxx
Port 2222
 
Back
Top